fix window preferences

This commit is contained in:
Zack Rauen 2018-08-21 14:05:13 -04:00
parent 3c38ecdd97
commit 1ccd7766bc
1 changed files with 10 additions and 3 deletions

View File

@ -47,7 +47,8 @@
return {
saved: {},
settingsSet: null,
disabled: false
disabled: false,
defaultFilePath: path.join(Globals.getPath('data'), 'window.json')
};
},
components: {
@ -56,7 +57,13 @@
},
computed: {
filePath() {
return Globals.require.resolve(path.join(Globals.getPath('data'), 'window'));
try {
return Globals.require.resolve(path.join(Globals.getPath('data'), 'window'));
}
catch (err) {
FileUtils.writeJsonToFile(this.defaultFilePath, {});
return this.defaultFilePath;
}
}
},
methods: {
@ -121,7 +128,7 @@
this.$options.components.SettingsPanel = SettingsPanel;
},
async created() {
if (this.filePath !== path.join(Globals.getPath('data'), 'window.json')) {
if (this.filePath !== this.defaultFilePath) {
this.disabled = true;
return;
}