Skip to content

Commit

Permalink
Try with try/catch
Browse files Browse the repository at this point in the history
  • Loading branch information
nsakaimbo committed Mar 26, 2020
1 parent 8e6a540 commit 029cb26
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion desktop/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,13 @@ const appData = path.join( app.getPath( 'appData' ), config.appPathName );

// Initialize log directory prior to requiring any modules that log
const logPath = process.env.WP_DEBUG_LOG ? process.env.WP_DEBUG_LOG : path.join( appData, 'logs', 'wp-desktop.log' );
mkdirSync( path.dirname( logPath ), { recursive: true } )
try {
mkdirSync( path.dirname( logPath ), { recursive: true } );
} catch ( err ) {
if ( err.code !== 'EEXIST' ) {
throw err;
}
}
state.setLogPath( logPath );

// Initialize settings
Expand Down

0 comments on commit 029cb26

Please sign in to comment.