Skip to content

Commit 3eee69f

Browse files
committed
fix update issue
1 parent 736199e commit 3eee69f

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ install: compile-schemas
1010
mkdir -p $(EXTENSION_DIR)
1111
cp extension.js $(EXTENSION_DIR)/
1212
cp prefs.js $(EXTENSION_DIR)/
13-
cp bangs.json $(EXTENSION_DIR)/
1413
cp metadata.json $(EXTENSION_DIR)/
1514
cp bang.png $(EXTENSION_DIR)/
1615
mkdir -p $(EXTENSION_DIR)/schemas

bangs.json

Lines changed: 0 additions & 2 deletions
This file was deleted.

extension.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,12 @@ export default class BangSearch extends Extension {
9191

9292
_loadBangs() {
9393
const bangsFile = this.dir.get_child('bangs.json');
94-
const [, contents] = bangsFile.load_contents(null);
95-
this.bangsData = JSON.parse(new TextDecoder().decode(contents));
94+
try {
95+
const [, contents] = bangsFile.load_contents(null);
96+
this.bangsData = JSON.parse(new TextDecoder().decode(contents));
97+
} catch (e) {
98+
this.bangsData = [];
99+
}
96100
}
97101

98102
enable() {

prefs.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,9 @@ export default class BangsSearchPreferences extends ExtensionPreferences {
104104
if (file.query_exists(null)) {
105105
const [, contents] = file.load_contents(null);
106106
return JSON.parse(new TextDecoder().decode(contents));
107+
} else {
108+
file.create(Gio.FileCreateFlags.NONE, null);
109+
return [];
107110
}
108-
return [];
109111
}
110112
}

0 commit comments

Comments
 (0)