Sublime ships with a Rust.sublime-build
file in the Rust
package. Packages that ship with Sublime are stored as sublime-package
files (really just a zip file) and are stored alongside the binary to stop you from having the urge to modify them directly, since when Sublime updates they get replaced wholesale.
You can view the contents of the file by using the View Package File
command from the command palette and selecting Rust/Rust.sublime-build
from the list (enter rust build
to filter the list quickly).
The results of that are this:
{
"cmd": ["rustc", "$file"],
"selector": "source.rust",
"file_regex": "^(.*?):([0-9]+):([0-9]+):\\s[0-9]+:[0-9]+\\s(.*)$",
"osx":
{
"path": "/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin"
},
"variants": [
{
"selector": "source.rust",
"cmd": ["./$file_base_name"],
"name": "Run",
"windows":
{
"cmd": ["$file_base_name.exe"]
}
}
]
}
What @wbond was getting at above is that you should follow the directions at the link to create an override. That means you want to:
- Use
Preferences/Browse Packages...
from the menu to open the Packages
folder
- Create a folder named
Rust
if one does not already exist
- Create a file inside of that folder named
Rust.sublime-build
with your modified contents
When you create those files/folders, make sure that you get the case correct.
When Sublime loads the Rust
package, it’s going to get to the part of the sublime-package
file that says that there is a file named Rust.sublime-build
. Then it will notice that there’s a file in the Rust
folder with that name and load that file instead of the one that’s inside of the sublime-package
file, which overrides the file in the package with your version.
So in your case, you should move the file that you created to be in that folder by that name to have it take the place of the existing one. Depending on what you used in your own build file you may or may not want to copy the contents above into your own and modify it as needed, in case you didn’t have a file_regex
or what have you.
Note also that the build above has a special osx
key that gives the build a specific path to use on that platform; you can create a similar key for your platform if it’s not osx
to provide a similar path.