Can no longer load document using command line

Having trouble installing Oxygen? Got a bug to report? Post it all here.
bhoylman
Posts: 6
Joined: Tue Oct 23, 2007 7:20 pm

Can no longer load document using command line

Post by bhoylman »

Hello --

Prior to 14.0 I could load a file into Oxygen via a simple command line invocation such as this:

oxygen14.exe some_filename.xml

where oxygen14.exe represents the fully qualified path to the executable. The file some_filename.xml would happily open up in an Oxygen window ready for editing. If Oxygen was running a new tab would be opened with the file. If Oxygen was not running then an instance would start up with all the previous files left open when last one stopped, and a new tab with the file in it.

Now if Oxygen is not currently running this type of invocation still works. However if Oxygen is already running, the running application is foregrounded, but no new tabs are opened and the file to be edited is not loaded.

Does this make sense? Let me know if you have questions, and thanks for a most excellent product.

Peace.

<oXygen/> XML Editor 14.0, build 2012080717
adrian
Posts: 2879
Joined: Tue May 17, 2005 4:01 pm

Re: Can no longer load document using command line

Post by adrian »

Hello,

I've tested with Oxygen v12.2, v13.2 and v14.0 but did not see a difference in the capabilities of opening a file from the command line.

Do you get an error message when trying this?
Can you give me a concrete example of a complete command line with arguments that you have tried?


If you provide as argument an absolute path to the file, it will always work.
However, if you use a relative path, it will not always work as expected. Oxygen tries to locate the file in its initial working directory (the directory where the Oxygen instance was started).

I'll explain with an example:
- I have files named personal.xml, personal.xsl, and personal.css located in D:\projects\samples
- In the command line the current directory is: D:\projects
- I start Oxygen and open a file from the samples directory located in D:\projects: "C:\path\to\Oxygen\oxygen14.0.exe" samples\personal.xml
- Oxygen starts and opens the file personal.xml from D:\projects\samples.
- I open another file from the samples directory in the running instance of Oxygen: "C:\path\to\Oxygen\oxygen14.0.exe" samples\personal.xsl
- The running instance of Oxygen opens the file personal.xsl from D:\projects\samples.
- I change the working directory from the command line to samples: cd samples and am now in D:\projects\samples
- I try to open another file from the current directory in the running instance of Oxygen: "C:\path\to\Oxygen\oxygen14.0.exe" personal.css
- This fails because Oxygen looks for personal.css in its initial working directory (where it was started): D:\projects, but the file is located in D:\projects\samples.
- To make it work, you have to use a path relative to Oxygen's initial working directory: "C:\path\to\Oxygen\oxygen14.0.exe" samples\personal.css

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
bhoylman
Posts: 6
Joined: Tue Oct 23, 2007 7:20 pm

Re: Can no longer load document using command line

Post by bhoylman »

Hello adrian --

Thanks for your prompt reply. Here are some more details.

The scenerio that no longer works for me is when Oxygen is already running and I want to edit open another file. I use the following command from a cygwin command prompt:

C:/PROGRA~1/Oxygen/OXYGEN~1.EXE 'C:\projects\capf\CONTEXT\build.xml'

If oxygen is running and either minimized or not the current foregrounded application, it will jump to the foreground. However no file will be loaded. No error message is generated either. The shell error status is '0' (successful). If oxygen is not currently running the above command works, i.e. oxygen starts, and the file I want to edit is loaded. That's the only time this command will now work, whereas I've been editing files like this for as long as I've used the product and it only recently stopped working.

I always use the fully qualified path to both the oxygen executable and the file I want to edit, just as I've shown in the above example.

I have tried deleting my current oxygen user profile but that had no effect, other than forcing me to activate the product again heh.

That's all I've got. Let me know if there's something else I can do to help out. Again, thanks for looking at this.

Peace.
bhoylman
Posts: 6
Joined: Tue Oct 23, 2007 7:20 pm

Re: Can no longer load document using command line

Post by bhoylman »

Oh, and this does not work from a CMD prompt either, in case you were wondering if it was strictly a cygwin usage issue.

Thanks again.
adrian
Posts: 2879
Joined: Tue May 17, 2005 4:01 pm

Re: Can no longer load document using command line

Post by adrian »

Hi,

Please note that single quotes(') around arguments aren't a standard in Windows. Some applications work with this (e.g Notepad) and some don't (e.g. Wordpad). The problem with single quotes is that they are legal characters for file names. You can actually have a file named: 'build.xml' (including the quotes).

The standard that is required to be supported by all Windows applications and is actually provided by the Windows API is to use double quotes around the arguments. Double quotes(") are special characters and cannot be used in file names.
The double quotes around a string in the command line ensure that the application receives exactly one argument for each string surrounded by a pair of quotes.

So, in short, if you run Oxygen like this:
C:/PROGRA~1/Oxygen/OXYGEN~1.EXE "C:\projects\capf\CONTEXT\build.xml"
it will work as expected.

I've tested and it worked indeed in v13.2 with single quotes, but since then we have updated the install4j installer implementation (which provides the executable launchers) and this probably caused this change.
However, oxygen.bat for example has never worked with such arguments surrounded by single quotes and will not work with them anytime soon.

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
bhoylman
Posts: 6
Joined: Tue Oct 23, 2007 7:20 pm

Re: Can no longer load document using command line

Post by bhoylman »

Hello --

So after much ado I resorted to uninstalling Oxygen and deleting my user profile. After reinstalling and registering the command line editing of files once again works. Perhaps some corruption resulting from all the various upgrades I've gone through? Not sure of why, only sure that it is working again.

Thanks for your prompt replies to my issue. I appreciate the support.

Peace.
adrian
Posts: 2879
Joined: Tue May 17, 2005 4:01 pm

Re: Can no longer load document using command line

Post by adrian »

Hi,

Are you sure it's now working with single quotes with v14.0?
e.g. C:/PROGRA~1/Oxygen/OXYGEN~1.EXE 'C:\projects\capf\CONTEXT\build.xml'
I'm asking this because I've tested this and it definitely did not work for me.

Anyway, if you want to make sure that it will work correctly in the future, I suggest using double quotes instead of single quotes. That's the way it was intended to be used.

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Post Reply