Skip to content

Commit

Permalink
- Fixed: Load queue fail on initial plugin install bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesb committed Sep 24, 2021
1 parent e2be80f commit 6218c08
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
6 changes: 5 additions & 1 deletion src/helpers/file-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@ export class FileUtils extends ObsidianUtilsBase {
super(app);
}

async exists(file: string) {
return await this.app.vault.adapter.exists(normalizePath(file));
}

async createIfNotExists(file: string, data: string) {
const normalizedPath = normalizePath(file);
if (!(await this.app.vault.adapter.exists(normalizedPath))) {
if (!(await this.exists(normalizedPath))) {
let folderPath = this.getParentOfNormalized(normalizedPath);
await this.createFolders(folderPath);
await this.app.vault.create(normalizedPath, data);
Expand Down
15 changes: 7 additions & 8 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,16 +231,15 @@ export default class IW extends Plugin {
}
}

async loadQueue(filePath: string) {
if (filePath && filePath.length > 0) {
this.statusBar.updateCurrentQueue(filePath);
this.queue = new Queue(this, filePath);
async loadQueue(file: string) {
if (file && file.length > 0) {
const table = await this.queue.loadTable();
const currentRep = table.currentRep();
this.statusBar.updateCurrentRep(currentRep);
LogTo.Console("Loaded Queue: " + filePath, true);
this.statusBar.updateCurrentRep(table?.currentRep());
this.queue = new Queue(this, file);
this.statusBar.updateCurrentQueue(file);
LogTo.Console("Loaded Queue: " + file, true);
} else {
LogTo.Console("Failed to load queue: " + filePath, true);
LogTo.Console("Failed to load queue.", true);
}
}

Expand Down

0 comments on commit 6218c08

Please sign in to comment.