🔧 Work on setting migration

This commit is contained in:
Simon Schneegans
2023-02-10 05:55:50 +01:00
parent 43130b4680
commit f2cf78971d
5 changed files with 133 additions and 53 deletions
+7 -5
View File
@@ -56,15 +56,17 @@ var ProfileManager = class {
return this._profiles;
}
// This will create a new profile with all values initialized to their defaults. The
// method will return an effect profile object (as described above). We will use the
// current system time in microseconds as profile name. This ensures that they are
// always sorted according to their creation date.
createProfile() {
// This will create a new profile. If no content is given, all values will be
// initialized to their defaults. The method will return an effect profile object (as
// described above). We will use the current system time in microseconds as profile
// name. This ensures that they are always sorted according to their creation date.
createProfile(content = '') {
const path = `${GLib.get_user_config_dir()}/burn-my-windows/profiles/${
GLib.get_real_time()}.conf`;
const file = Gio.File.new_for_path(path);
file.create(Gio.FileCreateFlags.NONE, null);
file.replace_contents(content, null, false, Gio.FileCreateFlags.REPLACE_DESTINATION,
null);
const profile = {'path': path, 'settings': this._getProfileSettings(path)};