@@ -70,8 +70,8 @@ export default class Storage {
7070 }
7171
7272 if ( Util . isset ( snippet , Snippet ) ) {
73- fs . writeFileSync ( this . storageDir + this . dir + snippet . getUID ( ) . split ( ' ' ) . join ( '-' ) + '.json' , JSON . stringify ( snippet , null , 2 ) ) ;
74- var temp = fs . existsSync ( this . storageDir + this . dir + snippet . getUID ( ) . split ( ' ' ) . join ( '-' ) + '.json' ) ;
73+ fs . writeFileSync ( path . join ( this . storageDir , this . dir , snippet . getUID ( ) . split ( ' ' ) . join ( '-' ) + '.json' ) , JSON . stringify ( snippet , null , 2 ) ) ;
74+ var temp = fs . existsSync ( path . join ( this . storageDir , this . dir , snippet . getUID ( ) . split ( ' ' ) . join ( '-' ) + '.json' ) ) ;
7575 if ( window . snippet_injector_debug . allowDebug && window . snippet_injector_debug . usrPref . timings ) {
7676 console . timeEnd ( "storage:store duration" ) ;
7777 }
@@ -91,7 +91,7 @@ export default class Storage {
9191 if ( window . snippet_injector_debug . allowDebug && window . snippet_injector_debug . usrPref . timings ) {
9292 console . time ( "storage:retrieveFiles duration" ) ;
9393 }
94- var temp = fs . readdirSync ( this . storageDir + this . dir ) ;
94+ var temp = fs . readdirSync ( path . join ( this . storageDir , this . dir ) ) ;
9595 if ( window . snippet_injector_debug . allowDebug && window . snippet_injector_debug . usrPref . timings ) {
9696 console . timeEnd ( "storage:retrieveFiles duration" ) ;
9797 }
@@ -106,7 +106,7 @@ export default class Storage {
106106 if ( window . snippet_injector_debug . allowDebug && window . snippet_injector_debug . usrPref . timings ) {
107107 console . time ( "storage:retrieveFile duration" ) ;
108108 }
109- var temp = fs . readFileSync ( this . storageDir + this . dir + uid . split ( ' ' ) . join ( '-' ) + '.json' ) ;
109+ var temp = fs . readFileSync ( path . join ( this . storageDir , this . dir , uid . split ( ' ' ) . join ( '-' ) + '.json' ) ) ;
110110 if ( window . snippet_injector_debug . allowDebug && window . snippet_injector_debug . usrPref . timings ) {
111111 console . timeEnd ( "storage:retrieveFile duration" ) ;
112112 }
@@ -135,8 +135,8 @@ export default class Storage {
135135 if ( window . snippet_injector_debug . allowDebug && window . snippet_injector_debug . usrPref . timings ) {
136136 console . time ( "storage:deleteFile duration" ) ;
137137 }
138- if ( fs . existsSync ( this . storageDir + this . dir + uid . split ( ' ' ) . join ( '-' ) + '.json' ) ) {
139- fs . unlinkSync ( this . storageDir + this . dir + uid . split ( ' ' ) . join ( '-' ) + '.json' ) ;
138+ if ( fs . existsSync ( path . join ( this . storageDir , this . dir , uid . split ( ' ' ) . join ( '-' ) + '.json' ) ) ) {
139+ fs . unlinkSync ( path . join ( this . storageDir , this . dir , uid . split ( ' ' ) . join ( '-' ) + '.json' ) ) ;
140140 if ( window . snippet_injector_debug . allowDebug && window . snippet_injector_debug . usrPref . timings ) {
141141 console . timeEnd ( "storage:deleteFile duration" ) ;
142142 }
@@ -166,7 +166,7 @@ export default class Storage {
166166 var _this = this ;
167167 files . forEach ( function ( current ) {
168168 if ( current . endsWith ( '.snippet.json' ) ) {
169- fs . renameSync ( store + current , store + current . replace ( '.snippet.json' , '.json' ) ) ;
169+ fs . renameSync ( path . join ( store , current ) , path . join ( store , current . replace ( '.snippet.json' , '.json' ) ) ) ;
170170 current = current . replace ( '.snippet.json' , '' ) ;
171171 } else {
172172 current = current . replace ( '.json' , '' ) ;
0 commit comments