mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-26 09:56:00 +00:00
fixed modify archive for windows
This commit is contained in:
@@ -9,6 +9,7 @@ const { getLogger } = require('dbgate-tools');
|
|||||||
const uuidv1 = require('uuid/v1');
|
const uuidv1 = require('uuid/v1');
|
||||||
const dbgateApi = require('../shell');
|
const dbgateApi = require('../shell');
|
||||||
const jsldata = require('./jsldata');
|
const jsldata = require('./jsldata');
|
||||||
|
const platformInfo = require('../utility/platformInfo');
|
||||||
|
|
||||||
const logger = getLogger('archive');
|
const logger = getLogger('archive');
|
||||||
|
|
||||||
@@ -136,8 +137,13 @@ module.exports = {
|
|||||||
});
|
});
|
||||||
const writer = await dbgateApi.jsonLinesWriter({ fileName: tmpchangedFilePath });
|
const writer = await dbgateApi.jsonLinesWriter({ fileName: tmpchangedFilePath });
|
||||||
await dbgateApi.copyStream(reader, writer);
|
await dbgateApi.copyStream(reader, writer);
|
||||||
|
if (platformInfo.isWindows) {
|
||||||
|
await fs.copyFile(tmpchangedFilePath, changedFilePath);
|
||||||
|
await fs.unlink(tmpchangedFilePath);
|
||||||
|
} else {
|
||||||
await fs.unlink(changedFilePath);
|
await fs.unlink(changedFilePath);
|
||||||
await fs.rename(path.join(tmpchangedFilePath), path.join(changedFilePath));
|
await fs.rename(tmpchangedFilePath, changedFilePath);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user