Change schema compare generated script filepath (#5496)

* generated script filepath defaults to folder last opened in file dialog

* use string interpolation
This commit is contained in:
kisantia
2019-05-16 14:55:08 -07:00
committed by GitHub
parent fcb2b53bf8
commit 3158e9f63a

View File

@@ -334,14 +334,14 @@ export class SchemaCompareResult {
}).component(); }).component();
this.generateScriptButton.onDidClick(async (click) => { this.generateScriptButton.onDidClick(async (click) => {
// get file path // generate default filename
let now = new Date(); let now = new Date();
let datetime = now.getFullYear() + '-' + (now.getMonth() + 1) + '-' + now.getDate() + '-' + now.getHours() + '-' + now.getMinutes() + '-' + now.getSeconds(); let datetime = now.getFullYear() + '-' + (now.getMonth() + 1) + '-' + now.getDate() + '-' + now.getHours() + '-' + now.getMinutes() + '-' + now.getSeconds();
let rootPath = vscode.workspace.rootPath ? vscode.workspace.rootPath : os.homedir(); let defaultFileName = `${this.targetName}_Update_${datetime}.sql`;
let defaultFilePath = path.join(rootPath, this.targetName + '_Update_' + datetime + '.sql');
let fileUri = await vscode.window.showSaveDialog( let fileUri = await vscode.window.showSaveDialog(
{ {
defaultUri: vscode.Uri.file(defaultFilePath), defaultUri: vscode.Uri.file(defaultFileName),
saveLabel: localize('schemaCompare.saveFile', 'Save'), saveLabel: localize('schemaCompare.saveFile', 'Save'),
filters: { filters: {
'SQL Files': ['sql'], 'SQL Files': ['sql'],