Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backup Plugin: Backup to a subdirectory of the home directory by default #9857

Closed
personalizedrefrigerator opened this issue Feb 5, 2024 · 3 comments · Fixed by #9942
Closed
Assignees
Labels
enhancement Feature requests and code enhancements

Comments

@personalizedrefrigerator
Copy link
Collaborator

personalizedrefrigerator commented Feb 5, 2024

Operating system

Linux

Joplin version

2.14

Current behaviour

Currently, the default Simple Backup plugin creates backups in a subdirectory of the profile directory. This could be problematic:

  • These backups may be difficult to discover.
  • If the profile directory is deleted, backups are also lost.

To make backups easier to discover, we might:

  1. By default, create backups in a subdirectory of the user's home directory (e.g. JoplinBackup).
  2. So that different profiles still have different backups, create subdirectories of JoplinBackup for each profile, like we do with ~/.config/joplin-desktop.
  3. Add a README or similar document to explain the JoplinBackup folder.
@personalizedrefrigerator personalizedrefrigerator added enhancement Feature requests and code enhancements high High priority issues v2.14 and removed high High priority issues labels Feb 5, 2024
@tomasz1986
Copy link

What about JoplinPortable? In its case, it does make a lot of sense to back up to the profile directory 🙂.

@JackGruber
Copy link
Contributor

If we need adjustments in the plugin, I can do that with pleasure. But it may take some time as I'm on vacation at the moment.

@personalizedrefrigerator
Copy link
Collaborator Author

personalizedrefrigerator commented Feb 6, 2024

If we need adjustments in the plugin, I can do that with pleasure. But it may take some time as I'm on vacation at the moment.

I'm also happy making pull requests for relevant changes :).

My current plan is to:

  1. Change the default backup path in desktopDefaultPluginsInfos.ts.
    • The logic for this will likely be similar to BaseApplication.determineProfileDir: for the parent directory, use process.env.PORTABLE_EXECUTABLE_DIR if in the portable application, initArgs.profileDir if given, and os.homedir() otherwise.
    • There will need to be additional logic for different profiles so that one profile's backup doesn't overwrite another's. For example, backups from different profiles can go into different subdirectories of JoplinBackup.
    • Unless it's acceptable to have a folder structure similar to JoplinBackup/JoplinBackup, JoplinBackup/profile-idhere/JoplinBackup, it might be necessary to somehow adjust the plugin. For example, to not delete subdirectories of JoplinBackup that start with profile-.
      • An alternative would be to disable the "create subfolder" setting and have Joplin create the JoplinBackup directory, but this could be dangerous if the user changes the backup path.
  2. Create a pull request: Update Simple Backup to create a README.md or similar file in the root of the backup directory. (Pull request)
    • This file could explain how to restore a backup (and perhaps include information about the most recent backup).

What about JoplinPortable? In its case, it does make a lot of sense to back up to the profile directory 🙂.

Currently, the profile directory is in the same directory as the executable (portable-path/JoplinProfile). I think backing up to portable-path/JoplinBackup could make sense in this case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature requests and code enhancements
Projects
None yet
3 participants