Persist save file location throughout a session (#772)

* persist save file location throughout a session

* added path logic to serializer instead of pathUtilities
This commit is contained in:
Aditya Bist
2018-03-08 11:18:25 -08:00
committed by GitHub
parent b7169f3da9
commit 090ac6eab2

View File

@@ -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;
}