Sublime Forum

What excatly is "$File"?

#1

I’m trying to use a build system to copy the file that you would build to a specific directory using a batch file but it’s not quite working… I looked at the wiki to find what $File returns but all I could find was

The full path, including folder, to the file in the active view.

All the batch file does is

copy %1 C:\temp\domes
start C:\temp\domes\work.exe

And the build system is

“cmd”: [“C:/temp/inwork/dec.bat”, “$File”]

I thought this would work because if you run the batch with a file after it in cmd then it works fine. But if I build it, then the program starts but no file gets copied anywhere.
I know next to nothing about JSON or batch for that matter so any and all ideas are welcome

0 Likes

#2

Variables in build systems are case sensitive; the appropriate variable is $file not $File.

All variables expand out when the build runs, but any variable that Sublime has no value for have a default value of nothing at all. So by using $File instead of $file, the variable expands out to nothing, and the command runs as if you provided it no argument at all.

0 Likes

#3

you once again save the day. I can’t believe that I missed that! I’m so embarrassed. This time there really are no more problems. Thank you beyond words!! You are truly a saint

1 Like