Merge pull request #237 from JsSucks/windowpreferences-patch

fix window preferences
This commit is contained in:
Alexei Stukov 2018-08-22 14:29:47 +03:00 committed by GitHub
commit 00ce5d70c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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;
}