Undocumented Folder Feature

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Undocumented Folder Feature

Martin Marris
Greetings,

There is a useful Sibelius.CreateFolder() command.

However I just found out that you often don't need it. If you use one of the
file-creation methods, such as Sibelius.CreateTextFile() and provide the
full file name including the folder path, it will create the folder if the
folder didn't already exist.

This is how some other programming languages work too, but I didn't realize
it worked that way in ManuScript, and as far as I can tell this (useful)
feature of the "create file" commands is not documented in the manual.

Martin


_______________________________________________
Plugin-dev mailing list
[hidden email]
http://avid-listsrv1.avid.com/mailman/listinfo/plugin-dev
Reply | Threaded
Open this post in threaded view
|

Re: Undocumented Folder Feature

Bob Zawalich
I think that this has not always been true. I have a number of plugins that
specifically check for the existence of a folder before  creating a file in
that folder with code that looks like this:

if (Sibelius.FolderExists(strFolderMP) = False)
{
        folderNew = Sibelius.CreateFolder(strFolderMP); // just create
without asking
        if (folderNew = null)
        {
                MyMessageBox(_msgCannotCreateFolder & strFolderMP);
                return False;
        }
}

It could be that there was a user-defined path and the code wanted to access
the folder to get its full path, and so it needed the folder to exist. But I
seem to remember having problems with folders not existing in the old days.

I have been doing this for a long time, though, and they may well have
changed that over time; if you do this in a not so recent version of
Sibelius, be sure to check that it worked, especially if the user types in a
path name.

Bob


-----Original Message-----
From: Martin Marris [mailto:[hidden email]]
Sent: Monday, September 21, 2015 9:54 AM
To: [hidden email]; 'A mailing list for Sibelius plug-in developers'
Subject: Undocumented Folder Feature

Greetings,

There is a useful Sibelius.CreateFolder() command.

However I just found out that you often don't need it. If you use one of the
file-creation methods, such as Sibelius.CreateTextFile() and provide the
full file name including the folder path, it will create the folder if the
folder didn't already exist.

This is how some other programming languages work too, but I didn't realize
it worked that way in ManuScript, and as far as I can tell this (useful)
feature of the "create file" commands is not documented in the manual.

Martin



_______________________________________________
Plugin-dev mailing list
[hidden email]
http://avid-listsrv1.avid.com/mailman/listinfo/plugin-dev