Skip to content
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

Default location of .jgo on Windows #57

Open
imagejan opened this issue Dec 12, 2019 · 2 comments
Open

Default location of .jgo on Windows #57

imagejan opened this issue Dec 12, 2019 · 2 comments

Comments

@imagejan
Copy link
Member

On Windows, it seems that Maven puts its .m2 folder into %USERPROFILE%\.m2 by default, whereas the default location for .jgo is %HOME%\.jgo.

This can be problematic in cases where %HOME% points to e.g. a network drive location (as required for environments using shared desktops across the machines of an organization). If that is different from %USERPROFILE% (which usually points to C:\Users\<username>), errors such as the one below can occur when using jgo via pyimagej in a Jupyter notebook:

FileNotFoundError: [WinError 3] The system cannot find the path specified: 'H:\\.m2\\repository\\com\\headius\\invokebinder\\1.2\\invokebinder-1.2.jar' -> 'H:\\.jgo\\net\\imglib\\imglib2-imglyb\\0.3.0+net.imagej-imagej-RELEASE+net.imglib-imglib2-imglyb-0.3.0+net.imglib-imglib2-imglyb-0.3.0\\invokebinder-1.2.jar'

@ctrueden can we change the default location of .jgo to %USERPROFILE%\.jgo as well? If not, we should at least fix the lookup for .m2 here:

jgo/jgo.sh

Lines 79 to 81 in 20553f3

m2Path() {
test "$M2_REPO" && echo "$M2_REPO" || echo "$HOME/.m2"
}

and change this:

jgo/jgo/jgo.py

Lines 169 to 170 in f1037d7

def m2_path():
return os.getenv("M2_REPO", (pathlib.Path.home() / '.m2').absolute())

to something like this:

def m2_path(): 
     return os.getenv("M2_REPO", os.path.join(os.environ['USERPROFILE'], ".m2").absolute())

A workaround would likely be to define an M2_HOME environment variable, right?

@hanslovsky
Copy link
Member

can we change the default location of .jgo to %USERPROFILE%\.jgo as well?

I don't see any reason why not.

@ctrueden
Copy link
Member

Sure, I think we should make it consistent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants