Is it possible to define a variable for File Watcher 'Program:' location? switching between mac/pc

I work between my mac and pc regularly everyday (work/home). I use the SCSS file watcher to compile my css but i have to manually go in and change the 'Program:' location when I change OS's or else I get errors.  Is it possible to define a variable to the '<ruby home>\bin' directory? Is this something possible already because I cant find something like this in the macros.

If this is not possible, is there a way to put a 'if on pc use this location, else use this location' or do something like add both paths to the Program: field and have it pick the one that exists?

2 comments
Comment actions Permalink

Hi there,

Yes -- check my comments in https://youtrack.jetbrains.com/issue/WI-22610

Basically -- it can be achieved with Path Variables functionality ("Settings/Preferences | Appearance & Behavior | Path Variables") -- it's an IDE-wide setting and it has to be done on all computers that will be using this project/file watcher.

The nuance is -- since it will be used on Windows and non-windows OS ... you have to point your file watcher program to the same-named executable (as "path variables" work with paths only). For example: for LESS compiler it will be just "lessc" on Mac/Linux and "lessc.cmd" on Windows. This means -- on your Mac/Linux you have to create a executable symlink (e.g. "lessc.cmd") that will point to real "lessc" and use "lessc.cmd" on all OS (reasons why described in that ticket as well -- they have even extracted this into separate WEB-11534 ticket).

1
Comment actions Permalink

Thank you a ton! This totally worked.  Once i figured out the <path to executable>/scss.bat converts to $pathVariable$ in the .xml it made sense.  figured out how to make a symlink and all is working great. I appreciate the assist. 

 

For others that might come across this here are the steps I used.

For windows the executable file is called 'scss.bat' and mac its 'scss'. (this can change depending on the program you use obviously).

1. Create a symlink on mac to have the same filename as the pc counterpart by opening terminal and using the command

'ln -s <pathToExecutable>/scss scss.bat'.

This will create a file named scss.bat in the same folder as the original scss file. you can define a location where you want the linked file by entering '<newLocationToSymlinkedFile>\scss.bat' as the second argument of that command. 

2. Create a path variable on pc named PATHVARIABLE (or whatever, as long as its the same on both OS's) and point that to the directory containing your scss.bat. In your file watcher dialogue, enter the full path to your scss.bat, e.g. '<windowsPathToFile>\scss.bat'.  NOT $PATHVARIABLE$, the program will take care of that for you. 

3. On mac create a path variable named the exact same as what you named the pc one e.g. PATHVARIABLE and point it to the directory where you created your scss.bat symlinked file. In the file watcher dialogue, ender the full path to your symlinked file e.g. '<macPathToSymlinkedFile>\scss.bat'

4. profit. 

0

Please sign in to leave a comment.