Skip to content

Commit

Permalink
fix(mobile): clone and delete local config dir
Browse files Browse the repository at this point in the history
  • Loading branch information
Vinzent03 committed Aug 22, 2022
1 parent f93ee6e commit 9b0bc8a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -498,9 +498,10 @@ export default class ObsidianGit extends Plugin {
const modal = new GeneralModal(this.app, [], "Enter remote URL");
const url = await modal.open();
if (url) {
let dir = await new GeneralModal(this.app, ["Vault root"], "Enter directory for clone. It needs to be empty or not existent.", this.gitManager instanceof IsomorphicGit).open();
const confirmOption = "Vault Root";
let dir = await new GeneralModal(this.app, [confirmOption], "Enter directory for clone. It needs to be empty or not existent.", this.gitManager instanceof IsomorphicGit).open();
if (dir !== undefined) {
if (dir === "Vault root") {
if (dir === confirmOption) {
dir = ".";
}

Expand All @@ -516,8 +517,9 @@ export default class ObsidianGit extends Plugin {
new Notice("Aborted clone");
return;
} else if (containsConflictDir === "YES") {
const modal = new GeneralModal(this.app, ["Abort clone", "DELETE ALL YOUR LOCAL CONFIG"], `To avoid conflicts, the local ${app.vault.configDir} directory needs to be deleted.`, false, true);
const shouldDelete = await modal.open() === "DELETE ALL YOUR LOCAL CONFIG AND PLUGINS";
const confirmOption = "DELETE ALL YOUR LOCAL CONFIG AND PLUGINS";
const modal = new GeneralModal(this.app, ["Abort clone", confirmOption], `To avoid conflicts, the local ${app.vault.configDir} directory needs to be deleted.`, false, true);
const shouldDelete = await modal.open() === confirmOption;
if (shouldDelete) {
await this.app.vault.adapter.rmdir(app.vault.configDir, true);
} else {
Expand Down

0 comments on commit 9b0bc8a

Please sign in to comment.