@@ -5,7 +5,9 @@ const { EXT_CONFIGS_DIR, APPDATA_DIRNAME } = require('./Constants');
55
66class path2
77{
8+ // static __dirname = path.join(__dirname, APPDATA_DIRNAME);
89 static __dirname = path . join ( app . getPath ( 'appData' ) , APPDATA_DIRNAME ) ;
10+
911 static config_location = path . join ( path2 . __dirname , EXT_CONFIGS_DIR ) ;
1012
1113 static joinAppData ( ...dir ) { return path . join ( path2 . __dirname , ...dir ) ; }
@@ -15,14 +17,18 @@ class path2
1517 static already_required = false ;
1618}
1719
20+
1821if ( ! path2 . already_required )
1922{
20- console . log ( 'creating dir' , path2 . config_location )
21- try { fs . mkdirSync ( path2 . config_location , { recursive : true } ) ; }
22- catch ( e ) { console . log ( "could not create path to" , EXT_CONFIGS_DIR , "in" , path2 . __dirname , "." , ) }
23- if ( ! fs . existsSync ( path . join ( __dirname , '..' , EXT_CONFIGS_DIR ) ) )
24- fs . symlinkSync ( path2 . config_location , path . join ( __dirname , '..' , EXT_CONFIGS_DIR ) ) ;
25-
23+ app . whenReady ( ) . then ( function ( )
24+ {
25+ console . log ( 'creating dir' , path2 . config_location )
26+ if ( ! fs . existsSync ( path2 . config_location ) )
27+ try { fs . mkdirSync ( path2 . config_location , { recursive : true } ) ; }
28+ catch ( e ) { console . log ( "could not create path to" , EXT_CONFIGS_DIR , "in" , path2 . __dirname , "." , ) }
29+ if ( ! fs . existsSync ( path . join ( __dirname , '..' , EXT_CONFIGS_DIR ) ) )
30+ fs . symlinkSync ( path2 . config_location , path . join ( __dirname , '..' , EXT_CONFIGS_DIR ) ) ;
31+ } ) ;
2632 path2 . already_required = true ;
2733}
2834
0 commit comments