Skip to content

Commit

Permalink
feat/SaveLocations: save locations before conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
westarne committed Nov 6, 2018
1 parent 161fbec commit 804b2c4
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions src/fileWriter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,14 +162,19 @@ class FileWriter implements ISerializable {

progress.report({ message: "Running..." });

let oldLocation = this.saveLocations.html[inputFile];
this.saveLocations.html[inputFile] = outputFile.toString();

let filename = await this.htmlConverter.toFile(
text,
outputFile.toString(),
path.dirname(inputFile),
options,
true);

this.saveLocations.html[inputFile] = filename;
true).catch((e) => {
if(this.saveLocations.html[inputFile] === outputFile.toString())
this.saveLocations.html[inputFile] = oldLocation;
throw e;
});
console.log("Saved at:", filename);
vscode.window.showInformationMessage("HTML File saved successfully.");
});
Expand Down Expand Up @@ -210,14 +215,19 @@ class FileWriter implements ISerializable {

progress.report({ message: "Running..." });

let oldLocation = this.saveLocations.pdf[inputFile];
this.saveLocations.pdf[inputFile] = outputFile.toString();

let filename = await this.pdfConverter.toFile(
text,
outputFile.toString(),
path.dirname(inputFile),
options,
true);

this.saveLocations.pdf[inputFile] = filename;
true).catch((e) => {
if(this.saveLocations.pdf[inputFile] === outputFile.toString())
this.saveLocations.pdf[inputFile] = oldLocation;
throw e;
});
console.log("Saved at:", filename);
vscode.window.showInformationMessage("PDF File saved successfully.");
});
Expand Down

0 comments on commit 804b2c4

Please sign in to comment.