Path functions

 < Day Day Up > 

Path functions get and manipulate the paths to various files and folders on a user's hard disk. These functions determine the path to the root of the site in which the current document resides, convert relative paths to absolute URLs, and more.

dreamweaver.getConfigurationPath()

Availability

Dreamweaver 2.

Description

Gets the path to the Dreamweaver Configuration folder, which is expressed as a file:// URL.

For information on how Dreamweaver accesses Configuration folders on a multiuser platform, see "C-Level Extensibility" in Extending Dreamweaver Help.

Arguments

None.

Returns

The path to the application configurations.

Example

The following function is useful when referencing other extension files, which are stored in the Configuration folder in the Dreamweaver application folder:

 var sortCmd = dreamweaver.getConfigurationPath() + "/Commands/Sort Table.htm" var sortDOM = dreamweaver.getDocumentDOM(sortCmd); 

dreamweaver.getDocumentPath()

Availability

Dreamweaver 1.2.

Description

Gets the path of the specified document, which is expressed as a file:// URL. This function is equivalent to calling dreamweaver.getDocumentDOM() and reading the URL property of the return value.

Arguments

 sourceDoc 

  • The value of the sourceDoc argument must be "document", "parent", "parent.frames[number]", or "parent.frames['frameName']". The "document" value specifies the document that has the focus and contains the current selection. The "parent" value specifies the parent frameset (if the currently selected document is in a frame), and the "parent.frames[number]" and "parent.frames['frameName']" values specify a document that is in a particular frame within the frameset that contains the current document.

Returns

Either a string that contains the URL of the specified document if the file was saved or an empty string if the file was not saved.

dreamweaver.getSiteRoot()

Availability

Dreamweaver 1.2.

Description

Gets the local root folder (as specified in the Site Definition dialog box) for the site that is associated with the currently selected document, which is expressed as a file:// URL.

Arguments

None.

Returns

Either a string that contains the URL of the local root folder of the site where the file is saved or an empty string if the file is not associated with a site.

dreamweaver.getTempFolderPath()

Availability

Dreamweaver MX.

Description

Gets the full path to a temporary folder where you can store temporary or transient files. This function looks for a Temp folder inside the Dreamweaver Configuration folder. If the system supports multiple users, it looks in the user's Configuration folder. If a Temp folder does not exist, the function creates it. Shared files that are not transient should be stored in the Configuration/Shared folder.

Arguments

None.

Returns

The full path to the folder, which is expressed as a file:// URL.

Example

The following line of code returns the full path for the specified file. The dw.getTempFolderPath() function does not return a slash (/) at the end of the path, as do other Dreamweaver functions (such as dreamweaver.getSiteRoot()):

 var myTempfile = dw.getTempFolderPath() + "/myTempFile.txt"; 

dreamweaver.relativeToAbsoluteURL()

Availability

Dreamweaver 2.

Description

Given a relative URL and a point of reference (either the path to the current document or the site root), this function converts the relative URL to an absolute file:// URL.

Arguments

 docPath, siteRoot, relURL 

  • The docPath argument is the path to a document on the user's computer (for example, the current document), which is expressed as a file:// URL or an empty string if relURL is a root-relative URL.

  • The siteRoot argument is the path to the site root, which is expressed as a file:// URL or an empty string if relURL is a document-relative URL.

  • The relURL argument is the URL to convert.

Returns

An absolute URL string. The return value is generated, as described in the following list:

  • If relURL is an absolute URL, no conversion occurs, and the return value is the same as relURL.

  • If relURL is a document-relative URL, the return value is the combination of docPath + relURL.

  • If relURL is a root-relative URL, the return value is the combination of siteRoot + relURL.

     < Day Day Up > 


    Developing Extensions for Macromedia Dreamweaver 8
    Developing Extensions for Macromedia Dreamweaver 8
    ISBN: 0321395409
    EAN: 2147483647
    Year: 2005
    Pages: 282

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net