Skip to content

Commit

Permalink
Bug fix for when guest requests file before it exists
Browse files Browse the repository at this point in the history
  • Loading branch information
daytonellwanger committed Jul 28, 2020
1 parent 0e4eb53 commit 0f89075
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/components/liveshare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,9 @@ export class LiveShare {
this.extension.logger.addCompilerMessage(`[Remote] ${message}`)
}

async requestPdf(texPath: string) {
async requestPdf(texPath: string, forceFetch = false) {
if (this.guestService) {
if (this.requestedPdfs.indexOf(texPath) < 0) {
if (this.requestedPdfs.indexOf(texPath) < 0 || forceFetch) {
this.requestedPdfs.push(texPath)
const p = async () => {
const results = await this.guestService?.request(requestPdfRequestName, [texPath])
Expand Down
2 changes: 1 addition & 1 deletion src/components/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ export class Manager {
*/
tex2pdf(texPath: string, respectOutDir: boolean = true) {
if (this.extension.liveshare.isGuest) {
this.extension.liveshare.requestPdf(texPath)
const livesharePdfPath = path.join(this.getOutDir(texPath), path.basename(`${texPath.substr(0, texPath.lastIndexOf('.'))}.pdf`))
this.extension.liveshare.requestPdf(texPath, !fs.existsSync(livesharePdfPath))
this.watchPdfFile(livesharePdfPath)
return livesharePdfPath
}
Expand Down

0 comments on commit 0f89075

Please sign in to comment.