You’ve got a few issues here; $USER
is going to be the name of your actual user:
tmartin:dart:~> echo $USER
tmartin
If you want to access your home directory, you need to use something like /home/$USER
or just $HOME
instead (which is generally better, a user’s home directory can be anywhere. See for example root
):
tmartin:dart:~> echo $HOME
/home/tmartin
Additionally, anything in shell_cmd
, cmd
or working_dir
in a build system that includes a $
is treated as a variable and expands out, and anything that’s not a known variable is expanded out to be an empy string, so $HOME
expands out to an empty string and your path would end up being /.config/sublime-text-3/packages
as a result, which isn’t valid and so the working dir is not set (probably you see an error in the console when this build runs as a result).
To use something with a $
in it you need to enter it as \\$
instead; that gets loaded by the JSON parser as \$
, Sublime sees it and converts it to $
without expanding anything, and it gets passed out to the command.
However all of that doesn’t really matter because it’s Sublime that needs to expand it if you’re going to use it in working_dir
and it doesn’t expand environment variables (that’s a job for your shell), so the directory won’t be set anyway.
The only variables you can use in shell_cmd
, cmd
and working_dir
that Sublime will expand are listed in the documentation on build systems; there’s one that expands out to the packages directory already. So what you want is this:
{
"shell_cmd": "pwd",
"working_dir": "$packages"
}