add: more settings options
This commit is contained in:
1 parent
ef444f211d
commit
252f15ffd9
1 file changed
+9
-2
@@ -10,6 +10,12 @@ const defaultSettings = {
|
||||
frontPort: '',
|
||||
backPort: '',
|
||||
portableMode: '',
|
||||
|
||||
libraryViewMode: '',
|
||||
favoritViewMode: '',
|
||||
watchlistViewMode: '',
|
||||
CollectionsViewMode: '',
|
||||
CollectionItemsViewMode: '',
|
||||
};
|
||||
|
||||
function getUserDataPath() {
|
||||
@@ -50,8 +56,9 @@ function getSettings() {
|
||||
function updateSettings(newSettings) {
|
||||
const settingsFilePath = getSettingsFilePath();
|
||||
|
||||
let updatedSettings = { ...userDataPath, ...newSettings };
|
||||
fs.mkdirSync(newSettings.userDataPath, { recursive: true }); // making sure the newly set data path is created before saving the new config
|
||||
const oldSettings = getSettings();
|
||||
let updatedSettings = { ...defaultSettings, ...oldSettings, ...newSettings };
|
||||
fs.mkdirSync(updatedSettings.userDataPath, { recursive: true }); // making sure the newly set data path is created before saving the new config
|
||||
fs.writeFileSync(settingsFilePath, JSON.stringify(updatedSettings, null, 2));
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user