Jsbool mm_getconfigfileattributes() – Adobe Extending Dreamweaver CS4 User Manual
Page 367

361
EXTENDING DREAMWEAVER CS4
C-level extensibility
Note: If you want to read the file before writing to it, open the file in
"read"
mode. When you want to write to the file,
close the read handle and open the file again in
"write"
or
"append"
mode.
Arguments
char *fileURL, char *mode
•
The char *fileURL argument is a pointer to a string that names the file that you are opening, which is provided as a
file:// URL. If it specifies a path in the Dreamweaver Configuration folder, the
MM_OpenConfigFile()
function
resolves the path before opening the file.
•
The char *mode argument points to a string that specifies how you want to open the file. You can specify
null
,
"
read
", "
write
", or "
append
" mode. If you specify "
write
" and the file does not exist, the
MM_OpenconfigFile()
function creates it. If you specify "
write
", the
MM_OpenConfigFile()
function opens the file with an exclusive
share. If you specify "
read
", the
MM_OpenConfigFile()
function opens the file with a non-exclusive share.
If you open the file in "
write
" mode, any existing data in the file is truncated before writing new data. If you open
the file in "
append
" mode, any data you write is appended to the end of the file.
Returns
An integer that is the operating system file handle for this file. Returns
-1
if the file cannot be found or does not exist.
Example
char *dwConfig = "file:///c|/Program Files/Adobe/Adobe Dreamweaver CS3/
Configuration/Extensions.txt";
int = fileno;
if(MM_ConfigFileExists(dwConfig))
{
fileno = MM_OpenConfigFile(dwConfig, "read");
}
JSBool MM_GetConfigFileAttributes()
Availability
Dreamweaver MX.
Description
This function finds the file and returns the attributes of the file. You can set any of the arguments except fileURL to
null
if you do not need the value.
Arguments
char *fileURL, unsigned long *attrs, unsigned long *filesize, unsigned long *modtime, unsigned long *createtime
•
The char *fileURL argument is a pointer to a string that names the file for which you want the attributes. You must
provide this argument as a file:// URL. If fileURL specifies a path in the Dreamweaver Configuration folder, the
MM_GetConfigFileAttributes()
function resolves the path before opening the file.
•
The unsigned long *attrs argument is the address of an integer that contains the returned attribute bits (see “
” on page 362 for available attributes).
•
The unsigned long *filesize argument is the address of an integer in which the function returns the file size in bytes.