Skip to content

Commit

Permalink
fix: 📌 improve compatibility
Browse files Browse the repository at this point in the history
Use `getAbstractFilebyPath()` instead of `getFileByPath()` to increase compatibility with older Obsidian versions. Bump ` obsidian` package version to `1.1.1`.
  • Loading branch information
johannrichard authored and jsonMartin committed May 20, 2024
1 parent cae1303 commit 994cfbb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { App, Plugin, PluginSettingTab, Setting } from 'obsidian';
import { App, Plugin, PluginSettingTab, Setting, TFile } from 'obsidian';
import Notify from 'notify';
import spacetime from 'spacetime';
import { Environment, Template, ConfigureOptions } from 'nunjucks';
Expand Down Expand Up @@ -310,11 +310,11 @@ export default class ReadwiseMirror extends Plugin {
let path = `${this.settings.baseFolderName}/${category.charAt(0).toUpperCase() + category.slice(1)
}/${sanitizedTitle}.md`;

const abstractFile = vault.getFileByPath(path);
const abstractFile = vault.getAbstractFileByPath(path);

// Overwrite existing file with remote changes, or
// Create new file if not existing
if (abstractFile) {
if (abstractFile && abstractFile instanceof TFile) {
// File exists
try {
await vault.process(abstractFile, function(data) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@rollup/plugin-node-resolve": "^11.2.1",
"@rollup/plugin-typescript": "^8.2.1",
"@types/node": "^14.14.37",
"obsidian": "^0.12.0",
"obsidian": "^1.1.1",
"rollup": "^2.32.1",
"tslib": "^2.2.0",
"typescript": "^4.2.4"
Expand Down

0 comments on commit 994cfbb

Please sign in to comment.