How to get the base directory in visual studio code snippet?
This supports Windows & Unix:
${TM_DIRECTORY/^.+[\\/\\\\]+(.*)$/$1/}
I wanted to add that in Windows the code above will print the entire directory.
You need to add a quadruple backslash vs the forward-slash:
${TM_DIRECTORY/^.+\\\\(.*)$/$1/}
Ok, finally found it.
${TM_DIRECTORY/^.+\\/(.*)$/$1/}
gives the base directory.
The part I didn't get was the "double escape" of the directory separator /
-> \\/
.