mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-07-25 22:12:59 +00:00
fix: synchronise case-only file renames safely
This commit is contained in:
@@ -54,6 +54,11 @@ export class ObsidianFileSystemAdapter implements IFileSystemAdapter<TAbstractFi
|
||||
return Promise.resolve(this.app.vault.getFiles());
|
||||
}
|
||||
|
||||
async renameFile(file: TFile, newPath: string): Promise<TFile> {
|
||||
await this.vault.rename(file, newPath);
|
||||
return file;
|
||||
}
|
||||
|
||||
statFromNative(file: TFile): Promise<UXStat> {
|
||||
return Promise.resolve({ ...file.stat, type: "file" });
|
||||
}
|
||||
|
||||
@@ -37,6 +37,10 @@ export class ObsidianVaultAdapter implements IVaultAdapter<TFile, TFolder> {
|
||||
return await this.app.vault.createBinary(path, toArrayBuffer(data), options);
|
||||
}
|
||||
|
||||
async rename(file: TFile, newPath: string): Promise<void> {
|
||||
return await this.app.vault.rename(file, newPath);
|
||||
}
|
||||
|
||||
async delete(file: TFile | TFolder, force = false): Promise<void> {
|
||||
if ("trashFile" in this.app.fileManager) {
|
||||
// eslint-disable-next-line obsidianmd/no-unsupported-api
|
||||
|
||||
Reference in New Issue
Block a user