Just for comparison purposes, I downloaded the portable version of Sublime 3131 and dropped it on one of my Windows machines to test with.
PureBasic.sublime-build
{
"shell_cmd": "\"$packages\\User\\Builds\\purebasic_build.bat\" \"$file\""
}
Packages/User/Builds/purebasic_build.bat
@echo off
echo I am a batch file
echo my first argument is %1
With this in place, I selected Tools > Build System > PureBasic
, put the cursor into the view for purebasic_build.bat
, and got this output:
I am a batch file
my first argument is "C:\Users\tmartin\Desktop\Sublime_3131\Data\Packages\User\Builds\purebasic_build.bat"
[Finished in 0.1s]
The following build system also works identically for me:
{
"cmd": ["$packages\\User\\Builds\\purebasic_build.bat", "$file"]
}
Something to keep in mind is that with cmd
, you’re passing an array of distinct string arguments, whereas with shell_cmd
you’re providing a string and requiring the shell to split the arguments apart itself.
This means that not only do you need to wrap your $file
in double quotes (or more specifically \"
to make the JSON in the build valid) in case the file you’re operating with is in a path that contains spaces, you also need to do so for the path to the batch file that you’re running if it has spaces. Above your output indicates that you have Sublime installed in a path with spaces in its name.
If this doesn’t work for you, I would suspect that it’s perhaps not using the build system that you think it’s using or possibly there is some package or modification interfering with things somehow, such as an override on Default/exec.py
or some such.
To verify that everything is working as expected, after you run the build you can check the console with View > Show Console
and see what Sublime says it tried to execute. For my example above, I see this:
Running C:\Users\tmartin\Desktop\Sublime_3131\Data\Packages\User\Builds\purebasic_build.bat C:\Users\tmartin\Desktop\Sublime_3131\Data\Packages\User\Builds\purebasic_build.bat