User Guide

Core objects 19
makePathFromDirAndFile(dirname,
plainFilename)
string, string The first argument must be expressed as file:/
/URL. Concatenates the two arguments to
return a file URL that references the
specified filename in the specified directory.
For example,
Files.makePathFromDirAndFile("file:///
work/reports", "logo.png")
returns "file:/
//work/reports/logo.png".
open(docname, bWrite)
string, Boolean The first argument must be expressed as file:/
/URL. Opens the specified file for reading or
writing. If the second argument is
true, the
file opens for writing; otherwise it opens for
reading. If the file cannot be opened, returns
null; otherwise, returns a Files object.
readline()
none Reads the next line from the file that is
referred to by the current Files object and
returns it as a string. The end-of-line
character(s) are not included in the string.
Returns
null if end-of-file is reached or if the
line is more than 2048 characters.
rename(docname,
newPlainFilename)
string, string The docname argument is a file path or a file
URL to the file that you want to rename.
The
newPlainFilename argument is the new
name to assign to the file.
The
rename method returns a URL path of the
newly renamed file if successful; otherwise
Fireworks returns
null.
setFilename(docname,
newPlainFilename)
string, string The first argument must be expressed as file:/
/URL. Returns a file URL with
docname
replaced by
newPlainFilename. For example,
Files.setFilename("file:///work/
logo.png", "oldlogo.png")
returns "file://
/work/oldlogo.png"
. This method does not
affect the file on disk; it simply provides a
convenient way to manipulate file URLs. To
change the name on disk, use
rename().
swap(docname1, docname2)
string, string Each argument must be expressed as a file://
URL. Swaps the contents of the two
specified files, so that each file contains the
contents of the other file. Only files (not
directories) can be swapped, and both files
must reside on the same drive. Returns
true
if the swap is successful;
false otherwise.
write(textString)
string Writes the specified string to the file that is
referred to by the current Files object. No
end-of-line characters are appended; to
include one, use
"\n".
Method Data type Notes