-
Notifications
You must be signed in to change notification settings - Fork 19
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
New setting: Allow creating subfolders for each profile #69
New setting: Allow creating subfolders for each profile #69
Conversation
// We assume that Joplin's profile structure is the following | ||
// rootProfileDir/ | ||
// | profileDir/ | ||
// | | [[profile content]] | ||
// or, if using the default, | ||
// rootProfileDir/ | ||
// | [[profile content]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is what Joplin's profile structure currently looks like. However, it doesn't seem to be documented anywhere...
Reading profiles.json
(which seems to not always exist) in the root profile directory may be another way to get this information. It also doesn't seem to be documented though.
public: true, | ||
advanced: true, | ||
label: i18n.__("settings.createSubfolderPerProfile.label"), | ||
description: i18n.__("settings.createSubfolderPerProfile.description"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might make sense to use SettingStorage.File
here so that this setting can be backed up. This wouldn't be consistent with the other settings though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My opinion is that there must be a Joplin API to backup all plugin settings and restore settings from selected plugins.
In my opinion, SettingStorage.File is not a good idea and not a good way to proceed. If so, Joplin should automatically convert all settings in one version to SettingStorage.File and not provide x ways.
I also don't understand why all the settings from the database have to be in a json file. But that is a different topic.
@@ -136,6 +136,15 @@ export namespace Settings { | |||
label: i18n.__("settings.createSubfolder.label"), | |||
description: i18n.__("settings.createSubfolder.description"), | |||
}, | |||
createSubfolderPerProfile: { | |||
value: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should enable this by default ... But not for already installed versions.
Can be made in the function upgradeBackupPluginVersion
.
Or what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or what do you think?
Currently, the upstream pull request makes Joplin responsible for setting the default backup directory to the home directory (rather this plugin). As such, there are tradeoffs to having this setting enabled by default.
Some reason(s) to not enable this by default:
- Extra directories: If the default backup directory for this plugin is kept as the user's profile directory, backups would then look like this:
profileDir/JoplinBackup/default
. Because each subprofile has its own profile directory, subprofile backups would be in directories like this:profileDir/profile-abcd/JoplinBackup/profile-abcd
. Observe that eachJoplinBackup
directory would have exactly one subdirectory.
Some reasons to enable this by default:
- Consistency: It will need to be enabled by default in the built-in version of Simple Backup to prevent backups from different profiles from overwriting one another. Enabling it here would then be consistent with the built-in version.
- The default values of settings in built-in plugins can be overridden here.
- Data safety: If a user manually changes multiple profiles to back up to the same location, having this setting enabled could prevent backups from being overwritten.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To summarize, I think enabling this by default only makes sense in the version built-in to Joplin. In other versions, the default backup location is within the profile directory, which is different for each profile.
…g-subfolders-for-each-profile
The README.md is created in the profile dir of the backup and not in the root directory. |
…g-subfolders-for-each-profile
Summary
Adds an option that, when enabled, creates a subdirectory for the current profile and appends it to the backup path.
Related to laurent22/joplin#9857.
Example
For example, if the user's backup
path
is set to the home directory andcreate subfolder
is enabled, creating a backup from the default profile might cause the directory structure to look like this:If a backup is then made from a profile with ID
9y9ql8ji
,Testing
This pull request has been manually tested using Joplin 2.14.12 by
profile-9y9ql8ji
directory has been created in/home/username-here/JoplinBackup/
default
directory has been created in/home/username-here/JoplinBackup/