Skip to content

Commit

Permalink
Dev/ianhu/add directory change to new export commands (#4151)
Browse files Browse the repository at this point in the history
* tests and hygiene

* new entry

* remove comment

* add directory change

* add news
  • Loading branch information
IanMatthewHuff committed Jan 28, 2019
1 parent 7ce203d commit 3190d6f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions news/2 Fixes/4140.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Have the new export commands use our directory change code
15 changes: 13 additions & 2 deletions src/client/datascience/historycommandlistener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,13 @@ export class HistoryCommandListener implements IDataScienceCommandListener {

await this.waitForStatus(async () => {
if (uri) {
const notebook = await this.jupyterExporter.translateToNotebook(cells);
let directoryChange;
const settings = this.configuration.getSettings();
if (settings.datascience.changeDirOnImportExport) {
directoryChange = uri.fsPath;
}

const notebook = await this.jupyterExporter.translateToNotebook(cells, directoryChange);
await this.fileSystem.writeFile(uri.fsPath, JSON.stringify(notebook));
}
}, localize.DataScience.exportingFormat(), file);
Expand Down Expand Up @@ -218,7 +224,12 @@ export class HistoryCommandListener implements IDataScienceCommandListener {
})));

// Then save them to the file
const notebook = await this.jupyterExporter.translateToNotebook(cells);
let directoryChange;
if (settings.datascience.changeDirOnImportExport) {
directoryChange = file;
}

const notebook = await this.jupyterExporter.translateToNotebook(cells, directoryChange);
await this.fileSystem.writeFile(file, JSON.stringify(notebook));

} finally {
Expand Down

0 comments on commit 3190d6f

Please sign in to comment.