beautypg.com

File access and multiuser configuration api – Adobe Extending Dreamweaver CS4 User Manual

Page 364

background image

358

EXTENDING DREAMWEAVER CS4

C-level extensibility

File access and multiuser configuration API

Adobe recommends that you always use the file access and multiuser configuration API to access the file system
through C-level extensions. For files other than Configuration files, the functions access the specified file or folder.

Dreamweaver supports multiple-user configurations for the Windows XP, Windows 2000, and Mac OS X operating
systems.

Typically, you install Dreamweaver in a restricted folder such as C:\Program Folders in Windows. As a result, only
users with administrator privileges can make changes in the Dreamweaver Configuration folder. To enable users on
multiuser operating systems to create and maintain individual configurations, Dreamweaver creates a separate
Configuration folder for each user. Whenever Dreamweaver or a JavaScript extension writes to the Dreamweaver
Configuration folder, Dreamweaver automatically writes to the user Configuration folder instead. This process lets
each user customize Dreamweaver configuration settings without disturbing the customized configurations of other
users.

Dreamweaver creates the user Configuration folder in a location where the user has full read and write access. The
location of the user Configuration folder depends on the user platform.

For Windows 2000 and Windows XP platforms:

:\Documents and Settings\\Application Data\Adobe\\

Dreamweaver CS4\Configuration

Note: It is possible that in Windows XP, this folder is inside a hidden folder.

For Mac OS X platforms:

:Users::Library:Application Support:Adobe:Dreamweaver CS4:Configuration

In many cases, JavaScript extensions open files and write to the Configuration folder. JavaScript extensions can access
the file system by using DWFile or MMNotes, or by 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. Then it redirects the call to the
user Configuration folder.

For example, in Windows 2000 or Windows XP, if the user asks for file:///C|/Program Files/Adobe/Adobe
Dreamweaver CS4/Configuration/Objects/Common/Table.htm, Dreamweaver searches for a Table.htm file in the
C:\Documents and Settings\username\adobe\Dreamweaver CS4\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. It also ensures that the file operations do not fail due to insufficient access
privileges. If the files in the Dreamweaver Configuration folder that your C-level extension accesses is created through
JavaScript with DWFile, MMNotes, or DOM manipulations, use the File Access and Multiuser Configuration API. It
is possible that these files are located in the Configuration folder of the user.

This manual is related to the following products: