Home Download Buy Blog Forum Support

Build System issue with paths containing spaces

Build System issue with paths containing spaces

Postby SyncViewS on Mon Jun 11, 2012 10:10 pm

Hi Guys,
I am writing a Syntax Highliter for MaxScript and have some issues with the custom build system. I use a COM component I didn't write, that allows me to send the code to 3ds Max to be executed. It accepts the full file path of the current script.

My build file is:
Code: Select all
{
   "cmd": ["mxscom.exe", "-f", "$file"],
   "selector": "source.MaxScript"
}


where:
mxscom.exe is the com object, in the same directory of sublime_text.exe
-f is the option to let the com object accept file paths
$file is the Sublime Text variable of the current full file path

The build works perfectly if there are not spaces in the file path:
C:\DevDirectory\MyScript.ms - works

If there are spaces, the OS adds double quotes to define the path so the $file variable becomes:
"C:\Dev Directory\MyScript.ms" - does not work

The error in 3ds Max Listener looks like:
Code: Select all
-- Runtime error: fileIn: can't open file - ""C:\Dev Directory\MyScript.ms""
   during OLE automation function call


Is there any way to make it work with paths containing spaces?
Is there any way to strip the double quotes, provided it is the actual issue?

Thank you very much

- Enrico
SyncViewS
 
Posts: 6
Joined: Tue May 22, 2012 9:33 am

Re: Build System issue with paths containing spaces

Postby bizoo on Tue Jun 12, 2012 6:00 am

I tried a Python source on a path with spaces and it work fine on my:
startup, version: 2199 windows x64 channel: nightly

What's your OS and ST2 version ?

Are you sure the issue is not in your MyScript.ms ?
Try writing a shell script that only print input parameter to the console.
bizoo
 
Posts: 879
Joined: Wed Dec 08, 2010 6:53 am
Location: Switzerland

Re: Build System issue with paths containing spaces

Postby SyncViewS on Tue Jun 12, 2012 6:53 am

Hi bizoo,
I'm using Sublime Text 2 Beta 2181 on Windows 7 x64.

The script is fine, as it works if I put it into a folder where the path does not contain any space.
It actually is just a print statement.

If I run the script from a DOS command prompt it is about the same, i.e.:

C:\mxscom.exe -f C:\test.ms - works

C:\mxscom.exe -f "C:\test.ms" - does not work
Code: Select all
-- Runtime error: fileIn: can't open file - ""c:\test.ms""
   during OLE automation function call

C:\mxscom.exe -f C:\MyFolder\test.ms - works

C:\mxscom.exe -f "C:\My Folder\test.ms" - does not work
Code: Select all
-- Runtime error: fileIn: can't open file - ""C:\My Folder\test.ms""
   during OLE automation function call


As an interesting debugging information if I feed the com with an invalid file, I get as an error in 3ds Max:

C:\mxscom.exe -f c:\testMe.ms - the file does not exists, so cannot work
Code: Select all
-- Runtime error: fileIn: can't open file - "c:\testMe.ms" -- Note quotes are not doubled
   during OLE automation function call


This is the reason why I was wondering if there is any way to strip the double quotes.
I have been using this com object with PSPad for years, and never got a problem, but Sublime Text is way better and more customizable.

Thanks

- Enrico
SyncViewS
 
Posts: 6
Joined: Tue May 22, 2012 9:33 am

Re: Build System issue with paths containing spaces

Postby bizoo on Tue Jun 12, 2012 7:17 am

If you open the console (View->Show Console) after running your build there must be something like:
Code: Select all
Running python -u C:\Temp\folder with space\test.py

What do you have on your system ?

There is a brand new build on http://www.sublimetext.com/dev, try if it's resolve your issue.
bizoo
 
Posts: 879
Joined: Wed Dec 08, 2010 6:53 am
Location: Switzerland

Re: Build System issue with paths containing spaces

Postby SyncViewS on Tue Jun 12, 2012 8:08 am

Hi bizoo,
thanks for your help.

After running the build, in console I've got:
Code: Select all
Running mxscom.exe -f C:\My Folder\test.ms

Which seems perfectly fine to me.

But I still get the issue with Max:
Code: Select all
-- Runtime error: fileIn: can't open file - ""C:\My Folder\test.ms""
   during OLE automation function call


I am going to try the new dev build as soon I can. I'll keep you posted with it.
Thanks!

- Enrico
SyncViewS
 
Posts: 6
Joined: Tue May 22, 2012 9:33 am

Re: Build System issue with paths containing spaces

Postby bizoo on Tue Jun 12, 2012 8:27 am

You can try adding this to your build file:
Code: Select all
{
   "cmd": ["mxscom.exe", "-f", "$file"],
   "shell": true,
   "selector": "source.MaxScript"
}

Not sure it help, but actually your issue is very strange and I've no other idea.
Good luck.
bizoo
 
Posts: 879
Joined: Wed Dec 08, 2010 6:53 am
Location: Switzerland

Re: Build System issue with paths containing spaces

Postby SyncViewS on Tue Jun 12, 2012 6:44 pm

Hi bizoo,
I tried the "shell" option on both versions of Sublime Text 2181 and 2200 with no luck.

I put the mxscom.exe in the Packages\user folder
Code: Select all
{
   "cmd": ["mxscom.exe", "-f", "$file"],
   "working_dir": "$packages\\User",
   "shell": true,
   "selector": "source.MaxScript"
}


The com is called but still in 3ds Max it appears the file path with doubled double-quotes.

Thanks

- Enrico
SyncViewS
 
Posts: 6
Joined: Tue May 22, 2012 9:33 am

Re: Build System issue with paths containing spaces

Postby jps on Wed Jun 13, 2012 8:29 am

SyncViewS: Your earlier post indicated that mxscom.exe doesn't handle paths with spaces even when called from the command line: is this true? If so, there's not much that can be done from within Sublime Text to help this.
jps
Site Admin
 
Posts: 3067
Joined: Wed Mar 19, 2008 12:33 pm

Re: Build System issue with paths containing spaces

Postby SyncViewS on Wed Jun 13, 2012 10:59 am

Hi Jon,
thanks for your reply.

I don't exactly know what is going on, because I can use this com component with PSPad and Notepad++ without issues, by specifying the same "-f" parameter and the full filepath.

In particular PSPad synthax is:

Code: Select all
Compiler
%PSPath%MaxScript\mxscom.exe

Parameters
-f %File%

Provided mxscom.exe is located in a folder within PSPad called MaxScript.

Please let me know if I can help in any other way.

Thank you

- Enrico
SyncViewS
 
Posts: 6
Joined: Tue May 22, 2012 9:33 am

Re: Build System issue with paths containing spaces

Postby jps on Wed Jun 13, 2012 11:34 am

Sublime Text expects command line utilities to work with quoted paths, if the command line program in question can't, then I can only suggest writing a wrapper program that will.
jps
Site Admin
 
Posts: 3067
Joined: Wed Mar 19, 2008 12:33 pm

Next

Return to Technical Support

Who is online

Users browsing this forum: Yahoo [Bot] and 24 guests