So I want to load a sound file into a buffer using a relative path. (I keep my stuff under version control and don't want to make any assumptions about where someone might clone the repo on their file system.)
So, I initially assumed that if I provided a path that looked relative then SC would interpret it as being relative to the location of the file being executed:
Buffer.read(s, "Samples/HiHats1.hihat2.wav");
But SC couldn't find the file. So I looked up asAbsolutePath
and tried that:
Buffer.read(s, "Samples/HiHats1.hihat2.wav".asAbsolutePath);
This doesn't work either because SC can't work out the absolute path from my relative one.
"Samples/HiHats1.hihat2.wav".asAbsolutePath
...actually returns a nonexistent location on my filesystem. Hurrah!
Can anyone make any suggestion as to how I might achieve this troublesome task?