Skip to content

Setting $HOME/Documents/Arduino as systemwide default sketchbook folder #2115

New issue

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

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

Already on GitHub? Sign in to your account

Open
ysalmon opened this issue Mar 15, 2019 · 4 comments
Open
Labels
os: linux Specific to Linux operating system topic: code Related to content of the project itself type: enhancement Proposed improvement

Comments

@ysalmon
Copy link

ysalmon commented Mar 15, 2019

I am currently trying to deploy the Arduino IDE to a bunch of Linux machines in a teaching environment. (disclaimer : I am not an Arduino user myself)

I am facing some difficulty with the way the IDE selects the sketchbook folder for a new user. In my tests it is located in ~/Arduino, and this is consistent with my understanding of the corresponding method in the Platform class for Linux.

I suggest it would be interesting to use $(xdg-user-dir DOCUMENTS)/Arduino which by default would be ~/Documents/Arduino. I am not proposing xdg-compliance just for the sake of it : in our concrete working environment with both Windows and Linux workstations, ~/Documents (and what is under it) is mounted to a CIFS network share that is accessible from Windows workstations as well, while ~ and ~/Arduino cannot be.

I tried to tweak the sketchbook.path preference in the global default preferences.txt but it does not seem to support variables like ~/Documents/Arduino or $HOME/Documents/Arduino.

I understand there has already been discussions about xdg directory structure compliance (#3915) and the migration problems a change would cause (arduino/Arduino#7651 (comment)).

So my suggestion is to maybe not make this default behaviour but allow for a xdg-compliance preference in the default, global preferences.txt (would be ignored if present in a user's file) that a system administrator could enable. This would make it possible to leave existing installations untouched while progressively adapting things, in a manner consistent with e.g. the linux install script which goes at lengths to use the xdg API.

Different but related : what is the rationale for reverting to the default sketchbook folder when the folder set in the preferences does not exist, instead of creating it (as is done for the default path anyway) ?

@lhanson
Copy link
Contributor

lhanson commented Oct 17, 2019

Please comply with users' XDG preferences, there is no reason to be creating yet another junk-drawer directory in a user's $HOME and numerous reasons not to.

@lhanson
Copy link
Contributor

lhanson commented Oct 17, 2019

Other conversation on the topic here: arduino/arduino-ide#1514

@ysalmon
Copy link
Author

ysalmon commented Oct 17, 2019

BTW if somebody is facing the same problem as me, here is an ugly workaround pending resolution of this :

after installing arduino IDE on the machine : mv /opt/arduino/arduino /opt/arduino/arduino.real then create an executable shell script /opt/arduino/arduino with content :

#!/bin/bash
mkdir -p $HOME/.arduino15
if [ ! -f $HOME/.arduino15/preferences.txt ]; then
  mkdir -p $(xdg-user-dir DOCUMENTS)/Arduino
  echo "sketchbook.path=$(xdg-user-dir DOCUMENTS)/Arduino" > $HOME/.arduino15/preferences.txt
fi
/opt/arduino/arduino.real $@

On first run by the user, this will create an appropriate default in the preferences.txt file.

@rhysday
Copy link

rhysday commented Sep 15, 2021

Arduino creates THREE folders in my HOME directory. Even if I create a wrapper and try to change HOME location it doesn't work because it's a java app.

@per1234 per1234 transferred this issue from arduino/Arduino Mar 17, 2023
@per1234 per1234 added type: enhancement Proposed improvement os: linux Specific to Linux operating system topic: code Related to content of the project itself labels Mar 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
os: linux Specific to Linux operating system topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Development

No branches or pull requests

4 participants