mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-16 23:30:41 +09:00
Use .tmp before the file extension (#529)
When creating temporary files use the pattern `.tmp.ext` instead of `.ext.tmp` to be consistent with Factorio which creates `.tmp.zip` files during saving. If patching fails this will leave a `.tmp.zip` file in the instance saves directory which is ignored by the default save selector. Resolves #486.
This commit is contained in:
1 parent
faadf873fb
commit
d5bcd34cdb
6 files changed
+28
-12
No files matched your search
@@ -86,7 +86,8 @@ class InstallError extends Error { }
|
||||
|
||||
|
||||
async function safeOutputFile(file, data, options={}) {
|
||||
let temporary = `${file}.tmp`;
|
||||
let { dir, name, ext } = path.parse(file);
|
||||
let temporary = `${dir}${name}.tmp${ext}`;
|
||||
await fs.outputFile(temporary, data, options);
|
||||
await fs.rename(temporary, file);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user