vesktop: fix crashing when settings.json or state.json are read-only (#368221)
This commit is contained in:
parent
3eecbac9c5
commit
e0e8116c18
19
pkgs/by-name/ve/vesktop/fix_read_only_settings.patch
Normal file
19
pkgs/by-name/ve/vesktop/fix_read_only_settings.patch
Normal file
@ -0,0 +1,19 @@
|
||||
diff --git a/src/main/settings.ts b/src/main/settings.ts
|
||||
index 6fad97f..dfc64e3 100644
|
||||
--- a/src/main/settings.ts
|
||||
+++ b/src/main/settings.ts
|
||||
@@ -26,8 +26,12 @@ function loadSettings<T extends object = any>(file: string, name: string) {
|
||||
|
||||
const store = new SettingsStore(settings);
|
||||
store.addGlobalChangeListener(o => {
|
||||
- mkdirSync(dirname(file), { recursive: true });
|
||||
- writeFileSync(file, JSON.stringify(o, null, 4));
|
||||
+ try {
|
||||
+ mkdirSync(dirname(file), { recursive: true });
|
||||
+ writeFileSync(file, JSON.stringify(o, null, 4));
|
||||
+ } catch (e) {
|
||||
+ console.error("Nix: Failed to write settings.", e);
|
||||
+ }
|
||||
});
|
||||
|
||||
return store;
|
@ -69,7 +69,10 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
];
|
||||
|
||||
patches =
|
||||
[ ./disable_update_checking.patch ]
|
||||
[
|
||||
./disable_update_checking.patch
|
||||
./fix_read_only_settings.patch
|
||||
]
|
||||
++ lib.optional withSystemVencord (
|
||||
replaceVars ./use_system_vencord.patch {
|
||||
inherit vencord;
|
||||
|
Loading…
x
Reference in New Issue
Block a user