Cabbage Logo
Back to Cabbage Site

Potential breaking change with paths in Csound

I recently made a change to how Cabbage runs. Until recently Cabbage would always set the folder containing the loaded .csd file as the current working directory. This had some knock-on effects for certain hosts, Unity, Sibelius, etc. Because these hosts all try to change the current working directory, things get screwy pretty quick. With the recent change, you can no longer take for granted that the location of the .csd file is the root directory. Best practice is to pass paths relative to your .cds file, i.e,

a1, a2 diskin2 sprintf("%s/pianoMood.wav", chnget:S("CSD_PATH")), 1, 0, 1

Or use a UDO:

opcode getFullPath, S,S
    SFile xin
    xout sprintf("%s/%s", chnget:S("CSD_PATH"), SFile) 

instr 1
    a1, a2 diskin2 getFullPath("pianoMood.wav"), 1, 0, 1 
    outs a1, a1

Thanks to @TartanLlama, and @Kzz for bringing to my attention the side effects of this change :+1: Note there is no issues with path uses in the Cabbage section as they are always relative to the current csd file.