From 16459572a031e39f0ad4898dc6917f3aebe2085e Mon Sep 17 00:00:00 2001 From: Silvano Cerza Date: Thu, 9 Jan 2025 09:42:00 +0100 Subject: [PATCH] Remove use of path module --- src/github/client.ts | 5 ++--- src/metadata-store.ts | 6 +----- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/github/client.ts b/src/github/client.ts index c3be102..0e7f347 100644 --- a/src/github/client.ts +++ b/src/github/client.ts @@ -1,6 +1,5 @@ import { Vault, requestUrl } from "obsidian"; import MetadataStore from "../metadata-store"; -import * as path from "path"; export default class GithubClient { constructor( @@ -55,7 +54,7 @@ export default class GithubClient { repo, dir.path, branch, - path.join(localContentDir, dir.name), + `${localContentDir}/${dir.name}`, ), ), ); @@ -103,7 +102,7 @@ export default class GithubClient { const res = await requestUrl({ url: url, }); - const destinationPath = path.dirname(destinationFile); + const destinationPath = destinationFile.split("/").slice(0, -1).join("/"); if (!this.vault.getFolderByPath(destinationPath)) { this.vault.createFolder(destinationPath); } diff --git a/src/metadata-store.ts b/src/metadata-store.ts index e1fd3b3..9c12c1b 100644 --- a/src/metadata-store.ts +++ b/src/metadata-store.ts @@ -1,5 +1,4 @@ import { Vault } from "obsidian"; -import * as path from "path"; /** * A file metadata. @@ -32,10 +31,7 @@ export default class MetadataStore { private writeQueue: Promise = Promise.resolve(); constructor(private vault: Vault) { - this.metadataFile = path.join( - this.vault.configDir, - "obsidian-github-sync-metadata.json", - ); + this.metadataFile = `${this.vault.configDir}/obsidian-github-sync-metadata.json`; } /**