How do you deal with spaces in MacOS file paths in SuperCollider?

Hello everyone

I am working on a super cool project I will share soon, but the last hurdle is this: How does one consistently escape spaces in MacOS paths? so that “Application Support” is not interpreted as two different paths but one path. I know I can find and replace spaces but it needs to be more consistent than that.

The main problem for me is that I am dealing with paths in SuperCollider which are then passed to a Pipe’d system command, and I want the system command that is called to be receiving a properly escaped path.

Thanks!

I use: .escapeChar($ )' or .escapeChar(Char.space)

FWIW, you don’t really need to escape spaces, you can also just put the path in double quotes - just as you would in a shell script. Example:

"ls %".format("C:/Program Files/SuperCollider-3.12.1".quote).systemCmd;