File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -27,7 +27,6 @@ const configuration = {
2727 userConfigPath = `${ userHome } /.config/Soundnode` ;
2828 }
2929
30-
3130 /** Linux platforms - XDG Standard */
3231 if ( process . platform === 'linux' ) {
3332 userConfigPath = `${ userHome } /.config/Soundnode` ;
@@ -38,20 +37,16 @@ const configuration = {
3837 userConfigPath = `${ userHome } /Library/Preferences/Soundnode` ;
3938 }
4039
41- // Guard to assert type of string.
42- if ( typeof userConfigPath !== "string" ) {
43- throw `Could not set userConfigPath for this OS ${ process . platform } `
40+ /** Unsupported platform */
41+ if ( userConfigPath === null ) {
42+ throw `could not set config path for this OS ${ process . platform } `
4443 }
4544
4645 // create user config in path
4746 // if there is no userConfig path
48- //
49- // fs.statSync will throw an exception if
50- // any directory along the path doesn't exist.
51- // Solution: use try catch.
5247 try {
53- var fi = fs . statSync ( userConfigPath ) ;
54- if ( ! fi . isDirectory ( ) ) {
48+ const configFileInfo = fs . statSync ( userConfigPath ) ;
49+ if ( ! configFileInfo . isDirectory ( ) ) {
5550 this . createUserConfig ( userConfigPath ) ;
5651 }
5752 }
You can’t perform that action at this time.
0 commit comments