I’ve been an actual user of my plugins for a few weeks and now I am back
I can get the path mostly working, but there seems to be a bug with long paths, which causes a plugin crash. I don’t know whether this is due to Csound or Cabbage. Below is an example.
Please see the comment at the end of path (OK / not OK). The problem is related to
SFile strcpy SPathToCsd
in connection with SFile cabbageGetValue "IO_SaveAs"
. If I don’t get the value, no problem. I hope this gives a clue what might be wrong or maybe I just need a different approach and perhaps not reuse the string?
Btw. Is there a more claver way of doing the commented block (which also causes crash when the csd has too long path)? Is there a way to detect the system file separator ("/", “”)?
<Cabbage>
form caption("Untitled") size(400, 300), guiMode("queue"), pluginId("def1")
filebutton bounds(10, 10, 70, 20) channel("IO_SaveAs") mode("save") text("SAVE AS", "SAVE AS") ; corners(3) colour:0(200, 80, 0, 180) colour:1(255, 255, 0, 255) fontColour:0(255, 255, 0, 255) fontColour:1(160, 0, 0, 255)
</Cabbage>
<CsoundSynthesizer>
<CsOptions>
-n -d -+rtmidi=NULL -M0 -m0d
</CsOptions>
<CsInstruments>
ksmps = 32
instr 1
/*
SPathToCsd chnget "CSD_PATH"
if chnget:i("WINDOWS") == 1 then
SPathToCsd strcat SPathToCsd, "\preset.txt"
else
SPathToCsd strcat SPathToCsd, "/preset.txt"
endif
*/
;SPathToCsd strcpy "/Users/Samo/Documents/test/0001/0002/0003/0004/0005/0006/0007/0008/0009/0010/0011/0012/0013/0014/0015/0016/0017/0018/0019/preset.txt"; not OK
SPathToCsd strcpy "/Users/Samo/Documents/test/0001/0002/0003/0004/0005/0006/0007/0008/0009/0010/0011/0012/0013/0014/0015/0016/0017/0018/preset.txt"; OK
SFile cabbageGetValue "IO_SaveAs"
SFile strcpy SPathToCsd
kFileValid init filevalid(SPathToCsd)
;printk 1, kFileValid
prints SPathToCsd, 1
endin
</CsInstruments>
<CsScore>
;causes Csound to run for about 7000 years...
f0 z
i 1 0 -1;[60*60*24*7]
</CsScore>
</CsoundSynthesizer>