CommandBox won't start in Windows if Binary is on different drive than home directory

Description

CommandBox won't start in Windows if Binary is on different drive than home directory. For instance, if your home directory is in your C: drive and you place box.exe in your D: drive, the following error occurs:

Page /Users/userName/.CommandBox/cfml/system/Bootstrap.cfm [D:\Users\userName\.CommandBox\cfml\system\Bootstrap.cfm] not found

It appears that CommandBox is looking for the home directory on the same drive that the exe is located.

The logic that determines the home path appears to be here on lines 69 through 83:
https://github.com/Ortus-Solutions/railo-cli/blob/master/src/java/cliloader/LoaderCLIMain.java#L69

I'm not sure which switch in the "if" statements is being hit. Debugging that on Windows will probably get us closer.

Activity

Show:
Brad Wood
June 21, 2014, 7:15 PM

No, I hadn't seen it. Well, since the uri variable is made by concatenating to the cli_home variable there's really no difference. Why write your own regular expression though? Java already gives you a method to extract the drive from a path via the getRoot() method of the Path class. See my second code snippet in my last comment.

Denny Valliant
June 21, 2014, 8:01 PM

The difference is that the URI might be a file to run, vs. the shell. (important re: file association stuff I mentioned.)

It probably wouldn't hurt to set up a VM with some flavor of linux (maybe a couple, Fedora & Debian at least) so you can test these things out yourself, and avoid some of the "helicopter pilot" effect (fixing one thing and breaking another). I generally test on at least Windows and Linux before I push something, and it's amazing how often something that works fine /here/, doesn't work /there/, as it were.

As for getting the path root, I use a simple regex because the testing I did using Path.getRoot() was not consistent across Windows and Linux, I like how the test just uses strings vs. files, and using files requires quite a bit more overhead (IO exceptions, wonkyness in getCannonicalFile, etc.), but I'm not married to it... feel free to give it a go yourself-- there is a junit4 test you can use to verify that it's working right. Or rather, passing the tests at least.

Denny Valliant
June 21, 2014, 8:47 PM

I bumped the Railo CLI version and the JRE version dependencies in both build-auto and build-local, which should fix this.

Luis Majano
July 1, 2014, 12:04 AM

not sure why not closing

Luis Majano
July 1, 2014, 12:04 AM

trying to see why it does not close

Done

Assignee

Luis Majano

Reporter

Brad Wood

Labels

None

Affects versions

None

Fix versions

Time tracking

0m

Time remaining

5h

Priority

Major