The attached plug-in is a simple demonstration plug-in for a rather complex function that writes text files.
The complexity lies in the error checking that (hopefully) makes the function robust on Linux, Mac and Windows.
The plug-in itself is not intended to be “useful” in itself - just a convenient way to test the function.
Validates file name (all 3 platforms).
Validates the path.
Checks that file can be opened for writing.
Outputs warning message if specified file cannot be written.
Fall-back mechanism if file cannot be written for any reason.
The plug-in is called “Write File” and is a “Generate” type plug-in.
Could you also try some Mac specific things that you think could give problems, such as using colons or slashes in the filename / path (you will know better than I what is likely to give problems, and whether it does “the right thing” or not).
Unfortunately I don’t think that we can allow “/” in the file name as it seems that Audacity/Nyquist won’t allow it (unless trying to output a “:” will produce a “/” in the file name).
If you (and/or any other Mac user) is interested in helping me to find out exactly what we can and can’t do, I can make up a little test plug-in for Mac OS X so that “/”, “:” and possible substitutions can be easily tested.
The simplest solution is to just not allow : or / in file names on Macs, but I’d like to get as close as possible to what Mac users are likely to expect and as I don’t have access to a Mac I need help.
Tried the new writefile.ny on Windows 7 (both 2.0.0 alpha Unicode and ANSI). I can only write to root of one of my internal drives (D: which is a small partition housing my Win XP installation). All the other drives give “not found” when writing to root (output is written to home directory).
I can write to root of U: which is the external drive and can write to root of a mapped network drive.
Thanks Gale. I’ve no idea why it is different on some drives to others. It works on the c: and d: drives of a real Vista machine that I borrowed, and it works on the d: drive of my XP virtual machine, but the c: drive shows the error. I think I have a workaround for the problem, but it’s messed up all of the output formatting, so I’ll need to fix that next.