diff options
author | bptato <nincsnevem662@gmail.com> | 2023-09-14 01:41:47 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2023-09-14 02:01:21 +0200 |
commit | c1b8338045716b25d664c0b8dd91eac0cb76480e (patch) | |
tree | a9c0a6763f180c2b6dd380aa880253ffc7685d85 /src/extern/tempfile.nim | |
parent | db0798acccbedcef4b16737f6be0cf7388cc0528 (diff) | |
download | chawan-c1b8338045716b25d664c0b8dd91eac0cb76480e.tar.gz |
move around more modules
* ips -> io/ * loader related stuff -> loader/ * tempfile -> extern/ * buffer, forkserver -> server/ * lineedit, window -> display/ * cell -> types/ * opt -> types/
Diffstat (limited to 'src/extern/tempfile.nim')
-rw-r--r-- | src/extern/tempfile.nim | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/extern/tempfile.nim b/src/extern/tempfile.nim new file mode 100644 index 00000000..d99ea4dc --- /dev/null +++ b/src/extern/tempfile.nim @@ -0,0 +1,18 @@ +import os + +var tmpf_seq: int +proc getTempFile*(tmpdir: string, ext = ""): string = + if not dirExists(tmpdir): + createDir(tmpdir) + var tmpf = tmpdir / "chatmp" & $tmpf_seq + if ext != "": + tmpf &= "." + tmpf &= ext + while fileExists(tmpf): + inc tmpf_seq + tmpf = tmpdir / "chatmp" & $tmpf_seq + if ext != "": + tmpf &= "." + tmpf &= ext + inc tmpf_seq + return tmpf |