I just copied this from Carl Licroys panel. It won’t save the file when hit cancel. It does a few checks, don’t know which is relevant for the cancel button:
fileToWrite=utils.saveFileWindow("Save patch to disk",File(suggestPatchNameFolder),"*.syx",true)
if fileToWrite:isValid()==false then return end
-- Check if the file exists
if fileToWrite:existsAsFile()==false then
-- If file does not exist, then create it
if fileToWrite:create()==false then
-- If file cannot be created, then fail here
utils.warnWindow("\n\nSorry, the Editor failed to\nsave the patch to disk!", "The file does not exist.")
return
end
end
if dataToWrite:getSize()<=0 then
utils.warnWindow("Data to write", "There is no data to write, we'll default to \"f0 00 f7\"")
dataToWrite=MemoryBlock("f0 00 f7")
end
-- If we reached this point, we have a valid file we can try to write to disk
if fileToWrite:replaceWithData (dataToWrite)==false then
utils.warnWindow ("File write", "Sorry, the Editor failed to\nwrite the data to file!")
end
-
This reply was modified 7 years, 11 months ago by Possemo.