Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 0b33b51

Browse files
Akos Kittakittaakos
Akos Kitta
authored andcommitted
Set XDG_CONFIG_HOME env on Linux when not set.
Otherwise, `node-log-rotate` creates a folder with `undefined` name. Closes #394. Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
1 parent 36ac47b commit 0b33b51

File tree

1 file changed

+14
-0
lines changed
  • electron/build/patch/backend

1 file changed

+14
-0
lines changed

‎electron/build/patch/backend/main.js‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
11
// @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+
216
const { setup, log } = require('node-log-rotate');
317
setup({
418
appName: 'Arduino IDE',

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /