mx icon indicating copy to clipboard operation
mx copied to clipboard

Fix intellijinit on Windows

Open okutane opened this issue 8 years ago • 7 comments

Hi! I 've just tried to run 'mx.cmd intellijinit' for sulong project on windows and got following error:

  File "T:\dev\sulong-dev\mx\/mx.py", line 15330, in <module>
    main()
  File "T:\dev\sulong-dev\mx\/mx.py", line 15314, in main
    retcode = c(command_args)
  File "T:\dev\sulong-dev\mx\/mx.py", line 12737, in intellijinit
    _intellij_suite(args, suite, refreshOnly, mx_python_modules, java_modules, suite != primary_suite())
  File "T:\dev\sulong-dev\mx\/mx.py", line 12959, in _intellij_suite
    path = os.path.relpath(library.get_path(True), s.dir)
  File "C:\Python27\lib\ntpath.py", line 529, in relpath
    % (path_prefix, start_prefix))
ValueError: path is on drive C:, start on drive T:

The problem occured because I've put my dev directory on T: drive and temp files were under my user directory on C:

I've implemented the minimal fix for my scenario which shouldn't break anything and afterwards reviewed neighboorhood code and added few similar fixes "just in case".

This is my first PR to mx and first PR in Python, so please give any necessary feedback on how to improve it and get it merged. :)

okutane avatar Apr 26 '17 21:04 okutane

I've tried to also test eclipseinit and netbeansinit, but there were unrelated problem (which maybe occured before relpath related problem could have happened), so no fixes there for now.

okutane avatar Apr 26 '17 21:04 okutane

Hello! Should this one be closed or something? :)

okutane avatar Mar 08 '18 18:03 okutane

Hi, This looks good to me. What about maybe_relpath as a function name? I think it would be clearer about the fact that it should only be used in cases where a non-relative path is acceptable.

gilles-duboscq avatar Mar 09 '18 09:03 gilles-duboscq

Currently also running into this problem; using that safe_relpath function as a replacement for os.path.relpath seems to do the trick.

JornVernee avatar Nov 07 '18 21:11 JornVernee

Currently I don't have time to update the PR, can someone else do it? :)

okutane avatar Nov 07 '18 22:11 okutane

Currently I don't have time to update the PR, can someone else do it? :)

I can not edit this PR (because I don't have push access to your fork), so I have created a separated one: https://github.com/graalvm/mx/pull/164

Is that OK with you?

JornVernee avatar Nov 08 '18 11:11 JornVernee

#164 was merged so i think this could be closed. Does it work for you @okutane?

gilles-duboscq avatar Nov 12 '18 16:11 gilles-duboscq