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

Consider the $HOME on Linux for locating the sketchbook folder #5054

Closed
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
1 participant
@gohai
Contributor

gohai commented May 5, 2017

The aim of this change is to make sudo -E processing{,-java} work with custom libraries installed in the invoking user's home directory.

@benfry
It turns out that I might need sudo -E after all for use with the Carnivore library, which reasonably needs superpowers to run. Unfortunately, it turns out that Java completely ignores $HOME even if set, so user.home and friends is always /root, which will make Processing not find the libraries the user installed via the Contribution Manager :(

I thought of a couple of ways of addressing this:

  • add an accessor function for all locations in P5 that use user.home (+ user.dir?) and simply return the value from $HOME instead if set and differing ... unfortunately my feeling is that the home directory might also be used in various indirect ways (~ etc), and having the two converge could lead to some hard-to-debug issues
  • overwrite the value of the user.home (+ user.dir?) somewhere right after startup ... Oracle's documentation says this is potentially dangerous
  • or, the attached patch, which just modifies the default sketchbook location on Linux ... this is good enough to get the Carnivore examples running for the default pi user with sudo -E.

In a similar way to modifying the default sketchbook location we additionally overwrite getSettingsFolder in LinuxPlatform.java - not sure if this is preferable or not (it's not needed to get the example going). I am thinking that it might be beneficial to refrain from writing any config files in the user's directory, since they would then be owned by root and could potentially no longer be edited by the user itself.

(Technically the caveat with sudo on Java probably also extends to macOS, but not sure if there are many games with sudo played over there...)

Consider the $HOME on Linux for locating the sketchbook folder
The aim of this change is to make "sudo -E processing{,-java}" work with custom libraries installed in the invoking user's home directory.

@gohai gohai requested a review from benfry May 5, 2017

@gohai gohai closed this May 8, 2017

@gohai gohai deleted the gohai:linux-sudo branch May 22, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment