Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Starting IDE creates "undefined" folder in current directory #394

Closed
JayPi4c opened this issue Jun 1, 2021 · 6 comments · Fixed by #1288
Closed

Starting IDE creates "undefined" folder in current directory #394

JayPi4c opened this issue Jun 1, 2021 · 6 comments · Fixed by #1288
Assignees
Labels
conclusion: resolved Issue was resolved criticality: medium Of moderate impact os: linux Specific to Linux operating system topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@JayPi4c
Copy link

JayPi4c commented Jun 1, 2021

Describe the bug
It is more an oddity than a bug.
Whenever I start the IDE the program creates a folder called "undefined" in my home directory. This folder contains only one folder called "Arduino IDE" which contains logs of the IDE. I think it's good that the logs are saved in an easy to find location. But all the time I'm looking into my home-folder the "undefined" folder kind of confuses me.

To Reproduce
Steps to reproduce the behavior:

  1. Start the IDE
  2. go to home folder
  3. be happy with "undefined" folder

Expected behavior
Just giving it a more precise name would make me happy.

Screenshots
screenshot

Desktop (please complete the following information):

  • OS: Linux Ubuntu 20.04.2 LTS
  • Version: 2.0.0-beta.7

Additional context
As already mentioned in #110 it is not perfectly documented how to install the IDE correctly, so i guess it could also be an error of me in the installation process. In my point of view I went a straight forward way, downloading the newest IDE, unzipping the contents and copying the files to /opt/
To have it listed in the applications menu of Ubuntu I created the file Arduino 2.0 (beta).desktop in ~/.local/share/applications with the following content:

[Desktop Entry]
Type=Application
# desktop entry spec version
Version=6.4.2
Name=Arduino 2.0 (beta)
Comment=Arduino IDE 2.0 beta
Exec=/opt/arduino-ide_2.0.0-beta.07/arduino-ide
Icon=/opt/arduino-1.8.13/lib/arduino.png
MimeType=image/svg+xml;
Terminal=false
Categories=Development
X-Desktop-File-Install-Version=0.24

It is mostly a copy of another .desktop file in the directory.

Now starting the IDE results in generating the undefined-folder. Everything else works perfectly.

@ralphtheninja
Copy link

ralphtheninja commented Jun 17, 2021

FWIW, I noticed this bug as well and did some digging. I think this is actually a bug inside Theia. But there's just too much typescript interface over engineered junk in the way and I could not find where a simple directory is created.

Another observation I made is that the undefined folder is created in the folder where you're starting the ide from, so if that's ~/arduino, then the ~/arduino/undefined folder will be created.

@cmaglie cmaglie removed the type: bug label Sep 16, 2021
@rsora rsora added the type: imperfection Perceived defect in any part of project label Sep 22, 2021
@per1234 per1234 added os: linux Specific to Linux operating system topic: code Related to content of the project itself labels Oct 25, 2021
@per1234 per1234 changed the title Starting IDE creates "undefined" folder in home directory Starting IDE creates "undefined" folder in current directory Oct 25, 2021
@rsora rsora added the priority: medium Resolution is a medium priority label Oct 25, 2021
@rsora rsora added criticality: medium Of moderate impact and removed priority: medium Resolution is a medium priority labels Nov 2, 2021
@ggl
Copy link

ggl commented Nov 13, 2021

I found it. It's here:

resources/app/node_modules/node-log-rotate/lib/utils/find-log-file-name.js

The module seems to be initialized here.

The default_1 function returns this log file name, with an obviously undefined path. It annoyed me to a great extent so I commented the return line and it doesn't do it any more.

@LordRafa
Copy link

LordRafa commented Feb 17, 2022

The error is related to an issue on the module node-log-rotate.

I have opened a PR with a fix, you can find more info here lemon-sour/node-log-rotate#23

Thanks @ggl for pointing me on the right direction.

@iwmq
Copy link

iwmq commented Mar 9, 2022

The undefined directory is still created for Arduino IDE 2 RC4. I found a workaround for this.

First, go to Arduino IDE 2 installation directory, open the file
resources/app/node_modules/node-log-rotate/lib/utils/find-log-path.js.

Then, find the following lines:

case 'linux':
	dir = prepareDir(process.env['XDG_CONFIG_HOME'] + '', appName)
		.or(process.env['HOME'] + '/.config', appName)
		.or(process.env['XDG_DATA_HOME'] + '', appName)
		.or(process.env['HOME'] + '/.local/share', appName).result;
	break;

And change them to:

case 'linux':
	dir = prepareDir("/tmp", "arduino_ide_2").result;
	break;

@fstasi
Copy link
Contributor

fstasi commented Mar 9, 2022

@LordRafa I saw your PR, thanks for that!
@iwmq I confirm that it fixes the problem on linux. The same workaround should be applied on darwin

Sadly, seems like node-log-rotate is not maintained anymore. We are currently looking for a better replacements. If that is not feasable we will fork it and apply the patches on our end

@kittaakos kittaakos self-assigned this Aug 4, 2022
kittaakos pushed a commit that referenced this issue Aug 4, 2022
Otherwise, `node-log-rotate` creates a folder with `undefined` name.

Closes #394.

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
@kittaakos
Copy link
Contributor

The same workaround should be applied on darwin

@fstasi, do we have a concrete bug report on macOS?

@per1234 per1234 added the conclusion: resolved Issue was resolved label Aug 5, 2022
kittaakos pushed a commit to kittaakos/arduino-ide that referenced this issue Aug 5, 2022
Otherwise, `node-log-rotate` creates a folder with `undefined` name.

Closes arduino#394.

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
conclusion: resolved Issue was resolved criticality: medium Of moderate impact os: linux Specific to Linux operating system topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging a pull request may close this issue.