There are many different ways to get the working directory in SuperCollider. If you are working on a script, and not writing a class, the easiest way to do so is to call
thisProcess.nowExecutingPath. See Process help file for more information.
If you are writing a class and you are on a Unix-based OS, you can use the following expressions.
The problem with the above expressions is that they don't work as "expected" if you have symlink the class name, so in my case I got
~/.local/share/SuperCollider/Extensions/MyClass.sc which is not my working directory.
Two workarounds that I found useful when you symlink a class definition are shown below. The first example calls an external process, and it's a bit slow in terms of execution time. The second is more efficient as it is in main class library.
"pwd".unixCmdGetStdOut; getPath = getPath.copyRange(0, getPath.size-2); //remove \n // File.getcwd;
Finally, notice the the first approach returns the full path of the working file, whereas the workarounds return only the working directory.