Undocumented Dreamweaver: Locating root folder for a specific site
Posted Monday, August 16, 2004 2:20:48 PM by Danilo Celic
Dreamweaver documents a couple of methods for obtaining the root folder for a site: dw.getSiteRoot() and site.getLocalPathToFiles(). However, both of these functions will return the root folder for the site that the currently focused document belongs to, the former a file:/// path and the latter a C:\ type of reference. If there are no documents open, then the root folder of the site shown in the Files panel is returned.
But what if you need to get the root folder for the site that is displayed so that you can open, copy, or create files based upon user input in one of your extensions and save them into the selected site? Well, if all the documents are closed, then you can do this using the API calls mentioned above, but you have to take into account that your users will likely be working on a document at the time that they invoke your extension.
Forunately, there is an undocumented API called site.getLocalRootURL(siteName) that does return the file:/// path to the specified site's folder. As long as you can grab the site name, you're off and running. So the code that you need is:
var siteName = site.getCurrentSite();
var siteRoot = site.getLocalRootURL(siteName);
Category tags: Dreamweaver, Extensibility
Posted by Danilo Celic
Add comment |
View comments (0) |
Permalink
|
Trackbacks (0)
|
Digg This
See Community MX content by Danilo Celic


Blog RSS feed













