File tree 1 file changed +14
-0
lines changed
electron/build/patch/backend
1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change 1
1
// @ts -check
2
+
3
+ // Patch for on Linux when `XDG_CONFIG_HOME` is not available, `node-log-rotate` creates the folder with `undefined` name.
4
+ // See https://github.com/lemon-sour/node-log-rotate/issues/23 and https://github.com/arduino/arduino-ide/issues/394.
5
+ // If the IDE2 is running on Linux, and the `XDG_CONFIG_HOME` variable is not available, set it to avoid the `undefined` folder.
6
+ // From the specs: https://specifications.freedesktop.org/basedir-spec/latest/ar01s03.html
7
+ // "If $XDG_CONFIG_HOME is either not set or empty, a default equal to $HOME/.config should be used."
8
+ const os = require ( 'os' ) ;
9
+ if ( os . platform ( ) === 'linux' && ! process . env [ 'XDG_CONFIG_HOME' ] ) {
10
+ const { join } = require ( 'path' ) ;
11
+ const home = process . env [ 'HOME' ] ;
12
+ const xdgConfigHome = home ? join ( home , '.config' ) : join ( os . homedir ( ) , '.config' ) ;
13
+ process . env [ 'XDG_CONFIG_HOME' ] = xdgConfigHome ;
14
+ }
15
+
2
16
const { setup, log } = require ( 'node-log-rotate' ) ;
3
17
setup ( {
4
18
appName : 'Arduino IDE' ,
You can’t perform that action at this time.
0 commit comments