Skip to content

Commit

Permalink
Feat: Add a README file to the root backup directory
Browse files Browse the repository at this point in the history
  • Loading branch information
personalizedrefrigerator committed Feb 7, 2024
1 parent a8f29fd commit b4f7612
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Backup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,7 @@ class Backup {
await this.backupNotebooks();

const backupDst = await this.makeBackupSet();
await this.writeReadme(backupDst);

await joplin.settings.setValue(
"lastBackup",
Expand Down Expand Up @@ -684,6 +685,16 @@ class Backup {
}
}

private async writeReadme(backupFolder: string) {
const readmePath = path.join(backupFolder, "README.md");
this.log.info("writeReadme to", readmePath);
const readmeText = i18n.__(
"backupReadme",
this.backupStartTime.toLocaleString()
);
await fs.writeFile(readmePath, readmeText, "utf8");
}

private async backupNotebooks() {
const notebooks = await this.selectNotebooks();

Expand Down
1 change: 1 addition & 0 deletions src/locales/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
"description": "Execute command when backup is finished"
}
},
"backupReadme": "# Joplin Backup\n\nThe backups in this folder were created with the Simple Backup plugin for Joplin. The most recent backup was created on %s.\n\nSee the [Simple Backup documentation](https://joplinapp.org/plugins/plugin/io.github.jackgruber.backup/#restore) for information about how to restore from this backup.",
"command": {
"createBackup": "Create backup"
}
Expand Down

0 comments on commit b4f7612

Please sign in to comment.