Skip to content

Commit

Permalink
add .anki2
Browse files Browse the repository at this point in the history
  • Loading branch information
74Genesis committed Nov 18, 2023
1 parent 73263d3 commit b0b3f9d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export const DB_FILES = {
latest: 'collection.anki21b',
legacy: 'collection.anki21',
anki21b: 'collection.anki21b', // modern version
anki21: 'collection.anki21', // legacy
anki2: 'collection.anki2', // oldest version
};
7 changes: 5 additions & 2 deletions src/core/AnkiDb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,13 @@ export default class AnkiDb extends Database {
}

get actualDbFile(): string {
let file = path.join(this.folder, DB_FILES.latest);
let file = path.join(this.folder, DB_FILES.anki21b);
if (fs.existsSync(file)) return file;

file = path.join(this.folder, DB_FILES.legacy);
file = path.join(this.folder, DB_FILES.anki21);
if (fs.existsSync(file)) return file;

file = path.join(this.folder, DB_FILES.anki2);
if (fs.existsSync(file)) return file;

return '';
Expand Down

0 comments on commit b0b3f9d

Please sign in to comment.