From 090ac6eab23e2f9e9df49b663a2b388101ebfbc9 Mon Sep 17 00:00:00 2001 From: Aditya Bist Date: Thu, 8 Mar 2018 11:18:25 -0800 Subject: [PATCH] Persist save file location throughout a session (#772) * persist save file location throughout a session * added path logic to serializer instead of pathUtilities --- src/sql/parts/query/common/resultSerializer.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/sql/parts/query/common/resultSerializer.ts b/src/sql/parts/query/common/resultSerializer.ts index 92bfcb47c6..619db10de6 100644 --- a/src/sql/parts/query/common/resultSerializer.ts +++ b/src/sql/parts/query/common/resultSerializer.ts @@ -29,6 +29,8 @@ import * as pretty from 'pretty-data'; import { ISlickRange } from 'angular2-slickgrid'; import * as path from 'path'; +let prevSavePath: string; + /** * Handles save results request from the context menu of slickGrid */ @@ -139,13 +141,14 @@ export class ResultSerializer { } private promptForFilepath(saveRequest: ISaveRequest): string { - let filepathPlaceHolder = PathUtilities.resolveCurrentDirectory(this._uri, this.rootPath); + let filepathPlaceHolder = (prevSavePath) ? prevSavePath : PathUtilities.resolveCurrentDirectory(this._uri, this.rootPath); filepathPlaceHolder = path.join(filepathPlaceHolder, this.getResultsDefaultFilename(saveRequest)); let filePath: string = this._windowService.showSaveDialog({ title: nls.localize('resultsSerializer.saveAsFileTitle', 'Choose Results File'), defaultPath: paths.normalize(filepathPlaceHolder, true) }); + prevSavePath = filePath; return filePath; }