-
-
Notifications
You must be signed in to change notification settings - Fork 7k
arduino commandline only full path accepted #1493
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
Comments
This seems a little bit complex to do, since the "arduino" shell script do a "cd $APPDIR" before starting the IDE, so from the Java side is impossible to obtain the original working directory (or maybe I'm missing something?). Some possible solutions could be:
C |
Why is not changing the current dir not simple? Because a lot of parts of the code assume a specific working directory? Or is there something fundamental? |
Fixed. Will be available in tomorrow nightly build: http://arduino.cc/en/Main/Software#toc4 |
This is still broken on OSX (and possibly also Windows?). See https://groups.google.com/a/arduino.cc/d/msg/developers/Ci1Ood_UAxw/GRs_1wcZ_S0J |
There is a solution for this since java 1.5. A java-class that is loaded from a jar can retrieve the location of its own jar-file on the filesystem. Here is a working code snippet taken from Stack Overflow
This piece of code works fine even if the path to the jar-file contains The "arduino" shell script needs to manualy switch the users working directory because The same functionality would be possible without touching the users working dir. Class There would be no need to do a |
Ah, that sounds useful. If we can remove the On Windows, we can then perhaps remove the chdir option from the launch4j config and make it work there as well (see my post to the mailing list I linked above). However, this does not really help on OSX where the java launcher insists on changing the directory IIRC. OTOH, I think the launcher used on OSX recently (1.5.8) changed, so perhaps the new launcher does have an option for this? |
Another approach to solve the problem on linux without changing too much in the java code, is to pass the
The method
instead of
and What about Windows ?I had quick look at launch4j and I think the
|
Running the IDE without changing the users working directory is possible on Linux and on Windows.In its current state the IDE uses the System.Propertiy In order to leave the I tested this on a fork of the ide-1.5.x branch. (File links point to my fork) Changes to the Java-CodeAll occurences of the WindowsFile build\windows\launcher\config.xml needs to be updated
LinuxFile build/linux/dist/arduino needs to be updated.
MacOsAs far as I can see the |
Thanks for looking into this, looks like you did your homework well :-)
The
Couldn't we just remove it altogether? Not sure if that would really have any advantages, though.
Note that there are currently two versions of the OSX launching code, one for java6 (in the |
I've googled around once more and I can't find a working way of knowing current directory when using the |
I wrote this little test application GetSystemPath.java for the commandline that reports the users current working dir, and the filesystem location of the jar file from which the little app is run. Here is a link to a jar-file with that class Run this jar from anywhere on your filessystem
If anybody could please try this on a Mac? Does it really fail on OSX???
This is not a hack AFAIK. |
@wayoda, it seems your example assumes running java directly, but on OSX Arduino uses an application launcher thingy AFAIK, that changes the current directory on startup (so I'd expect that your GetSystemPath thingy will then return the changed directory, not the original). I might be wrong, I've never actually used a Mac... |
So does windows (launch4j), but it is easy to fix this. |
What do you mean by "fix"? Stop using the launcher, or configure the launcher to not change the working dir? It seems that on OSX, the latter isn't possible (at least I couldn't find a way, looking at documentation only, last time I tried). |
There is an config file for the launch4j utillity that creates the windows exe in The key From launch4j-config
|
Yeah, I can see how that would work on Windows. However, AFAIK (last time I checked, anyway) we don't use launch4j on OSX, but some Apple-provided launcher thing. Or did this change recently? |
The important function for all of this is
... the method I was proposing for the other platforms too. So to me the only question is:
|
The answer is "no": it's always set to user's HOME, despite the location of the app, despite your current directory when you launch it from a terminal |
Thanks for testing, too bad! Looks like OSX is simply broken in respect to the Java Documentation on |
Indeed :( |
FYI, I've opened an issue at https://bitbucket.org/infinitekind/appbundler/issue/14/missing-a-way-for-having-current-working |
Please give a spin to #3421 as soon as bot has published it |
Linux version with #3421 pulled in compiles and runs fine. |
I'm glad to say: fixes. Fix will be available in next hourly build http://www.arduino.cc/en/Main/Software#hourly |
the .ino full path must be given.
either of following two will not work
$arduino some_proj.ino
$arduino ./some_proj.ino
it works only in this way.
$arduino
pwd
/some_proj.inomy environment.
arduino version: downloaded from here http://downloads.arduino.cc/arduino-1.5.2-linux64.tgz
java version "1.7.0_21"
OpenJDK Runtime Environment (IcedTea 2.3.9) (7u21-2.3.9-0ubuntu0.12.04.1)
OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode)
The text was updated successfully, but these errors were encountered: