mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-12 07:04:52 +09:00
Fixed async logic within lib/file_ops.js
This commit is contained in:
1 parent
ed73e3ad1e
commit
f266c441db
1 file changed
+4
-3
@@ -72,10 +72,11 @@ async function findUnusedName(directory, name, extension = "") {
|
||||
async function getTempFile(prefix, suffix, tmpdir) {
|
||||
prefix = (typeof prefix !== "undefined") ? prefix : "tmp.";
|
||||
suffix = (typeof suffix !== "undefined") ? suffix : "";
|
||||
tmpdir = tmpdir ? tmpdir : os.tmpdir();
|
||||
tmpdir = (typeof tmpdir !== "undefined") ? tmpdir : "./";
|
||||
let fileName = path.join(prefix + crypto.randomBytes(16).toString("hex") + suffix);
|
||||
let fullPath = path.join(tmpdir, findUnusedName(tmpdir, fullname));
|
||||
return fullpath;
|
||||
let freeFile = await findUnusedName(tmpdir, fileName);
|
||||
let fullPath = path.join(tmpdir, freeFile);
|
||||
return fullPath;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
||||
Reference in new issue
Block a user