Closed benwbooth closed 10 years ago
Actually, the idea of chdir
ing into imagejDir only when the -psn
flag was passed was carefully thought out (but not properly documented, as you found out to my chagrin): we use the launcher for many a use case, including running macros from the command line and launching the ImageJ.app from the icon. In the latter case, it is kind of okay to chdir
into imagejDir (as a convenience for the user), but in the former case it would be a major bug to do so. Just imagine you want to run a macro in the current directory via
/Applications/Fiji.app/Contents/MacOS/ImageJ-macosx this-here-macro.ijm
Currently, it is found correctly. Good. With the change in this PR, it would no longer be found correctly...
I agree I have to document this better.
But now I am curious: why do you need this change? Just for consistency, or do you have a concrete use case where you require this (e.g. because the file chooser refuses to let you switch into Fiji.app/
without jumping through hoops by drag-n-dropping files/folders from the Finder into the file chooser)?
I'm trying to run Micro-Manager as a Fiji plugin. Unfortunately, Micro-Manager looks for its plugins directory in the current working directory, so if the launcher doesn't chdir into the Fiji directory, then the Micro-Manager plugins don't appear in the UI. As a workaround I modified the JVM options in the Info.plist file to explicitly pass in the Micro-Manager plugin directories as property values. However, it would be nice if I didn't have to modify the Info.plist in order for everything to work.
In any case, the "-psn" flag is no longer passed in in Mavericks, so I guess you'll have to find another mechanism to determine if ImageJ was launched from the Finder
Unfortunately, Micro-Manager looks for its plugins directory in the current working directory
I guess that is the bug we have to address, then...
In any case, the "-psn" flag is no longer passed in in Mavericks
Oh, we can probably address this issue separately anyway. Since I am on Snow Leopard right now and have no easy access to a Mavericks installation, could you execute the following Beanshell in your Fiji.app (just hit [
to start the script editor, then select Language>Beanshell):
print(System.getenv());
If you compare the output between a Fiji.app started from the command-line vs the Dock icon, do you see a difference? We might use that as a better indicator than -psn
.
Here is what I get when running from the Dock icon:
Started New_.bsh at Wed Jun 25 10:43:36 PDT 2014
{SHELL=/bin/bash, TMPDIR=/var/folders/sv/7m1mxyn90yv0gbjny6nn_4fm000xnk/T/, DYLD_LIBRARY_PATH=/Applications/Fiji.app/lib/macosx:/Applications/Fiji.app/mm/macosx, com.apple.java.jvmMode=client, APP_NAME_26504=ImageJ, __CF_USER_TEXT_ENCODING=0x76B2:0:0, PATH=/usr/bin:/bin:/usr/sbin:/sbin, APP_ICON_26504=/Applications/Fiji.app/Contents/Resources/Fiji.icns, DISPLAY=/tmp/launch-Lxczfb/org.macosforge.xquartz:0, USER=bbooth, com.apple.java.jvmTask=JNI, HOME=/Users/ben, LOGNAME=bbooth, Apple_PubSub_Socket_Render=/tmp/launch-kKtn34/Render, SSH_AUTH_SOCK=/tmp/launch-MjK7W2/Listeners, __CHECKFIX1436934=1}
And here is what I get from running on the command-line:
Started New_.bsh at Wed Jun 25 10:45:11 PDT 2014
{TERM=xterm-256color, DYLD_LIBRARY_PATH=/Applications/Fiji.app/lib/macosx:/Applications/Fiji.app/mm/macosx, JAVA_HOME=/Library/Java/JavaVirtualMachines/1.6.0_65-b14-462.jdk/Contents/Home, TERM_PROGRAM=iTerm.app, GENDATA=/data/GenData, PWD=/Applications/Fiji.app/Contents/MacOS, CONSED=/usr/local/bdgp/consed_mac-27.0/bin/consed, BC_ENV_ARGS=/Users/ben/.bc, MACHTYPE=x86_64, PS1=\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ , PERLBREW_PERL=perl-5.20.0, BLASTDB=/data/blast/db, PERLBREW_PATH=/Users/ben/.perlbrew/macair/root/bin:/Users/ben/.perlbrew/macair/root/perls/perl-5.20.0/bin, TMPDIR=/var/folders/sv/7m1mxyn90yv0gbjny6nn_4fm000xnk/T/, EDITOR=vim, BDGPCONF=/usr/local/bdgp/etc/conf, PATH=/Users/ben/.perlbrew/macair/root/bin:/Users/ben/.perlbrew/macair/root/perls/perl-5.20.0/bin:/Users/ben/bin:/usr/local/share/npm/bin:/Users/ben/.cabal/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/texbin:/sbin:/bin:/usr/bin/vendor_perl:/usr/bin/site_perl:/usr/bin:/bin:/usr/sbin:/sbin, LESS=-FMXSRi, PERLBREW_BASHRC_VERSION=0.69, PAGER=less, Apple_PubSub_Socket_Render=/tmp/launch-kKtn34/Render, LSCOLORS=ExGxcxdxCxcgcdabagacad, BDGPDATA=/usr/local/bdgp/data, PERLBREW_ROOT=/Users/ben/.perlbrew/macair/root, ITERM_PROFILE=Default, BLASTFILTER=/usr/local/bdgp/wublast/filter, com.apple.java.jvmMode=client, PERLDB_OPTS=ReadLine=1, SHLVL=1, NODE_PATH=:/usr/lib/node_modules, WINEARCH=win32, __CF_USER_TEXT_ENCODING=0x76B2:0:0, MANPATH=/Users/ben/.perlbrew/macair/root/perls/perl-5.20.0/man:/usr/local/share/man:/usr/share/man:/usr/texbin/man:/Applications/Xcode.app/Contents/Developer/usr/share/man:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/share/man, CDNATERM=/opt/X11/bin/xterm, PERLBREW_MANPATH=/Users/ben/.perlbrew/macair/root/perls/perl-5.20.0/man, APP_NAME_26546=ImageJ, PHRAPVIEW_PARAMETERS=/usr/local/bdgp/etc/phrapview.dat, LOGNAME=bbooth, _=./ImageJ-macosx, __CHECKFIX1436934=1, SSH_AUTH_SOCK=/tmp/launch-MjK7W2/Listeners, BDGP=/usr/local/bdgp, ABIdata=/data/ABIdata, OLDPWD=/Applications/Fiji.app, SHELL=/bin/bash, ITERM_SESSION_ID=w0t1p0, PHRED_PARAMETER_FILE=/usr/local/bdgp/phrap/etc/phredpar.dat, BDGPBIN=/usr/local/bdgp/bin, PERLBREW_HOME=/Users/ben/.perlbrew/macair/home, BDGPLIB=/usr/local/bdgp/lib, DISPLAY=/tmp/launch-Lxczfb/org.macosforge.xquartz:0, USER=bbooth, PERLBREW_VERSION=0.69, com.apple.java.jvmTask=JNI, APP_ICON_26546=/Applications/Fiji.app/Contents/Resources/Fiji.icns, HOME=/Users/ben, HOMEBREW_CASK_OPTS=--appdir=/Applications, ABIDATA=/data/ABIdata, BDGPETC=/usr/local/bdgp/etc, CONSED_PARAMETERS=/usr/local/bdgp/etc/.consedrc, LANG=en_US.UTF-8}
Here's the diff:
diff --git a/dock.txt b/cli.txt
index c05b496..49e6da1 100644
--- a/dock.txt
+++ b/cli.txt
@@ -1,15 +1,60 @@
-APP_ICON_26504=/Applications/Fiji.app/Contents/Resources/Fiji.icns
-APP_NAME_26504=ImageJ
+ABIDATA=/data/ABIdata
+ABIdata=/data/ABIdata
+APP_ICON_26546=/Applications/Fiji.app/Contents/Resources/Fiji.icns
+APP_NAME_26546=ImageJ
Apple_PubSub_Socket_Render=/tmp/launch-kKtn34/Render
+BC_ENV_ARGS=/Users/ben/.bc
+BDGP=/usr/local/bdgp
+BDGPBIN=/usr/local/bdgp/bin
+BDGPCONF=/usr/local/bdgp/etc/conf
+BDGPDATA=/usr/local/bdgp/data
+BDGPETC=/usr/local/bdgp/etc
+BDGPLIB=/usr/local/bdgp/lib
+BLASTDB=/data/blast/db
+BLASTFILTER=/usr/local/bdgp/wublast/filter
+CDNATERM=/opt/X11/bin/xterm
+CONSED=/usr/local/bdgp/consed_mac-27.0/bin/consed
+CONSED_PARAMETERS=/usr/local/bdgp/etc/.consedrc
DISPLAY=/tmp/launch-Lxczfb/org.macosforge.xquartz:0
DYLD_LIBRARY_PATH=/Applications/Fiji.app/lib/macosx:/Applications/Fiji.app/mm/macosx
+EDITOR=vim
+GENDATA=/data/GenData
HOME=/Users/ben
+HOMEBREW_CASK_OPTS=--appdir=/Applications
+ITERM_PROFILE=Default
+ITERM_SESSION_ID=w0t1p0
+JAVA_HOME=/Library/Java/JavaVirtualMachines/1.6.0_65-b14-462.jdk/Contents/Home
+LANG=en_US.UTF-8
+LESS=-FMXSRi
LOGNAME=bbooth
-PATH=/usr/bin:/bin:/usr/sbin:/sbin
+LSCOLORS=ExGxcxdxCxcgcdabagacad
+MACHTYPE=x86_64
+MANPATH=/Users/ben/.perlbrew/macair/root/perls/perl-5.20.0/man:/usr/local/share/man:/usr/share/man:/usr/texbin/man:/Applications/Xcode.app/Contents/Developer/usr/share/man:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/share/man
+NODE_PATH=:/usr/lib/node_modules
+OLDPWD=/Applications/Fiji.app
+PAGER=less
+PATH=/Users/ben/.perlbrew/macair/root/bin:/Users/ben/.perlbrew/macair/root/perls/perl-5.20.0/bin:/Users/ben/bin:/usr/local/share/npm/bin:/Users/ben/.cabal/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/texbin:/sbin:/bin:/usr/bin/vendor_perl:/usr/bin/site_perl:/usr/bin:/bin:/usr:/sbin:/sbin
+PERLBREW_BASHRC_VERSION=0.69
+PERLBREW_HOME=/Users/ben/.perlbrew/macair/home
+PERLBREW_MANPATH=/Users/ben/.perlbrew/macair/root/perls/perl-5.20.0/man
+PERLBREW_PATH=/Users/ben/.perlbrew/macair/root/bin:/Users/ben/.perlbrew/macair/root/perls/perl-5.20.0/bin
+PERLBREW_PERL=perl-5.20.0
+PERLBREW_ROOT=/Users/ben/.perlbrew/macair/root
+PERLBREW_VERSION=0.69
+PERLDB_OPTS=ReadLine=1
+PHRAPVIEW_PARAMETERS=/usr/local/bdgp/etc/phrapview.dat
+PHRED_PARAMETER_FILE=/usr/local/bdgp/phrap/etc/phredpar.dat
+PS1=\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$
+PWD=/Applications/Fiji.app/Contents/MacOS
SHELL=/bin/bash
+SHLVL=1
SSH_AUTH_SOCK=/tmp/launch-MjK7W2/Listeners
+TERM=xterm-256color
+TERM_PROGRAM=iTerm.app
TMPDIR=/var/folders/sv/7m1mxyn90yv0gbjny6nn_4fm000xnk/T/
USER=bbooth
+WINEARCH=win32
+_=./ImageJ-macosx
__CF_USER_TEXT_ENCODING=0x76B2:0:0
__CHECKFIX1436934=1
com.apple.java.jvmMode=client
@benwbooth To be honest, I hoped for an analysis from your side...
Okay, after spending time on the analysis myself, I think that the PWD
environment variable is a good tell-tale.
@benwbooth feel free to make up for it by updating your pull request ;-)
That's the same conclusion I just came to! You beat me to it :) I'll update pull request.
How about squashing those two commits? In general, we try to avoid to introduce flawed code in the same PR that fixes it. It is easy to fix, too: just call git rebase -i HEAD~2
, add the line exec git reset --soft HEAD^^ && git commit -C HEAD@{1}
after the two pick
lines, save and quit the editor. That's it. Except for the forced push: git push origin +HEAD
.
OK, I guess that should do it. Thanks!
Perfect! Thank you so much!
See issue #17