File tree Expand file tree Collapse file tree 4 files changed +9
-6
lines changed Expand file tree Collapse file tree 4 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,6 @@ install: compile-schemas
10
10
mkdir -p $(EXTENSION_DIR )
11
11
cp extension.js $(EXTENSION_DIR ) /
12
12
cp prefs.js $(EXTENSION_DIR ) /
13
- cp bangs.json $(EXTENSION_DIR ) /
14
13
cp metadata.json $(EXTENSION_DIR ) /
15
14
cp bang.png $(EXTENSION_DIR ) /
16
15
mkdir -p $(EXTENSION_DIR ) /schemas
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -91,8 +91,12 @@ export default class BangSearch extends Extension {
91
91
92
92
_loadBangs ( ) {
93
93
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
+ }
96
100
}
97
101
98
102
enable ( ) {
Original file line number Diff line number Diff line change @@ -104,7 +104,9 @@ export default class BangsSearchPreferences extends ExtensionPreferences {
104
104
if ( file . query_exists ( null ) ) {
105
105
const [ , contents ] = file . load_contents ( null ) ;
106
106
return JSON . parse ( new TextDecoder ( ) . decode ( contents ) ) ;
107
+ } else {
108
+ file . create ( Gio . FileCreateFlags . NONE , null ) ;
109
+ return [ ] ;
107
110
}
108
- return [ ] ;
109
111
}
110
112
}
You can’t perform that action at this time.
0 commit comments