Macromedia dreamweaver 8-extending dreamweaver Manuel D’Utilisation

Page de 504
File Access and Multiuser Configuration API
471
There are many cases where JavaScript extensions open files and write to the Configuration 
folder. JavaScript extensions can access the file system by using DWFile, MMNotes, or 
passing a URL to the 
dreamweaver.getDocumentDOM()
 function. When an extension 
accesses the file system in a Configuration folder, it generally uses the 
dw.getConfigurationPath()
 function and adds the filename, or it gets the path by 
accessing the 
dom.URL
 property of an open document and adding the filename. An extension 
can also get the path by accessing the 
dom.URL
 and stripping the filename. The 
dw.getConfigurationPath()
 function and the 
dom.URL
 property always return a URL in 
the Dreamweaver Configuration folder, even if the document is located in the user 
Configuration folder. 
Any time a JavaScript extension opens a file in the Dreamweaver Configuration folder, 
Dreamweaver intercepts the access and checks the user Configuration folder first. If a 
JavaScript extension saves data to disk in the Dreamweaver Configuration folder through 
DWFile or MMNotes, Dreamweaver intercepts the call and redirects it to the user 
Configuration folder.
For example, in Windows 2000 or Windows XP, if the user asks for "
file:///C|/Program 
Files/Macromedia/Dreamweaver/Configuration/Objects/Common/Table.htm
", 
Dreamweaver searches for a Table.htm file in the C:/Documents and Settings/username/
Macromedia/Dreamweaver/Configuration/Objects/Common folder and, if it exists, uses 
it instead.
C-level extensions, or shared libraries, must use the File Access and Multiuser Configuration 
API to read and write to the Dreamweaver Configuration folder. Using the File Access and 
Multiuser Configuration API lets Dreamweaver read and write to the user Configuration 
folder and ensures that the file operations do not fail due to insufficient access privileges. If 
your C-level extension accesses files in the Dreamweaver Configuration folder that were 
created through JavaScript with DWFile, MMNotes, or DOM manipulations, it is essential 
that you use the File Access and Multiuser Configuration API because these files might be 
located in the user Configuration folder.
When you delete a file from the Dreamweaver Configuration folder, Dreamweaver adds an 
entry to a mask file to indicate which files in the Configuration folder should not appear in 
the user interface. A masked file or folder does not appear to exist to Dreamweaver although it 
might physically exist in the folder.
NOT
E
Most JavaScript extensions do not need to be changed to write to the user 
Configuration folder. Only C shared libraries that write to the Configuration folder need to 
be updated to use the File Access and Multiuser Configuration API functions.