Sublime Forum

Build System failing when filepath contains spaces

#1

Sublime Text newbie here… please forgive my peasant knowledge base. I’m having an issue with creating a new build system to compile PolyML scripts from within Sublime Text 3. When I am building a Hello World script from within a file path such as C:\Users\Craig\test.ml, the build succeeds and looks like the following (as expected):

Poly/ML 5.6 Release
Hello Worldval it = (): unit

This is eqivalent to the output when executing directly from the command line. When building from within file paths such as C:\Users\Craig\This is a test file\test.ml fail with the following message:

Poly/ML 5.6 Release
Error trying to use the file: 'C:\Users\Craig\This'
[Finished in 0.1s]

I’m using the following build file:

{
  "cmd": "polyml --use $file"
}

Unfortunately I can’t just avoid using filepaths with spaces as I’m using pre-existing infrastructure. Running ST3 Build Number 3114 on Windows 10 64-bit. Any advice would be greatly appreciated…

0 Likes

#2
{
  "cmd": ["polyml", "--use", "$file"]
}

cmd should be an array

Alternatively, use shell_cmd and embed escaped quotes.

{
  "shell_cmd": "polyml --use \"$file\""
}
2 Likes

#3

This worked. Thanks for the help :smile:

0 Likes