![]() |
![]() |
![]() |
![]() |
Home | Documentation ... Contact |
![]() |
Constructors |
|
File(string filename) |
Create a new file object based on the file specified by filename.
|
Folder(string foldername [, boolean create]) |
Create a new folder object based on the directory specified by foldername. If it doesn't exist and create is true, create the directory.
|
TextStream(string filename [, short mode [, boolean create]]) |
Create a text stream based on the file specified by filename. Specify the mode to be MODE_READ, MODE_WRITE, or MODE_APPEND. If it doesn't exist and create is true, create the file.
|
Constants |
|
readonly short MODE_READ |
Constant passed to the constructor
for Sash.FileSystem.TextStream; Signifies opening
the file for reading |
readonly short MODE_WRITE |
Constant passed to the constructor
for Sash.FileSystem.TextStream; Signifies opening
the file for writing, thus overwriting all its contents |
readonly short MODE_APPEND |
Constant passed to the constructor
for Sash.FileSystem.TextStream; Signifies opening
the file for writing, but unlike with MODE_WRITE, writing results in
appending to the stream |
Properties |
|
readonly string WeblicationDirectory |
Read-only string property that
contains the working path of the currently running weblication |
Methods |
|
string BuildPath(string path, string fileName) |
Returns a string representing
the path to the file specified by the string fileName
and the string path - on Unix systems
is equivalent to putting a '/' between the two if it is not already present |
void MoveFile(string source, string target) |
Move the file specified by the
string source to a new location
specified by the string target |
void CopyFile(string source, string target [, overwrite ]) |
Copy the file specified by the
string source to the location specified
by the string target, the optional boolean
parameter overwrite specifies whether
to overwrite target if it exists. The default for
overwrite is false - no overwriting occurs |
void DeleteFile(string
target [, boolean force]) |
Delete the file with path specified
by the string target. The optional boolean
parameter force specifies whether to
delete the file if it has its read-only attribute set. The default for force is false - no deleteing of read-only files |
void MoveFolder(string source, string target) |
The same as MoveFile(
...), but for whole folders (directories). All contents of the
folder are recursively moved |
void CopyFolder(string source, string target[, boolean overwrite]) |
The same as CopyFile(
...), but for whole folders (directories). All contents of the
folder are recursively copied |
void DeleteFolder(string target [, boolean force]) |
void The same as DeleteFile(
...), but for whole folders (directories). All contents of the
folder are recursively deleted |
boolean FileExists(
target) |
Returns true if the file
with path specified by the string target
exists, false otherwise |
boolean FolderExists(string target) |
Returns true if the folder
(directory) with path specified by the string target
exists, false otherwise |
string GetAbsolutePathName(string relativePath) |
Returns the absolute path to the
item pointed to by the string relativePath |
string GetBaseName(string path) |
Returns the file name portion
of the string path without the file
extension |
string GetExtensionName(string path) |
Returns the file extension portion
of the string path |
string GetFileName(string path) |
Returns the file name portion
of the string path including the file
extension |
string GetParentFolderName(string path) |
Returns the name of the parent
folder of the item specified by the string path
; Returns an empty string if there's no parent folder specified |
string GetTempName() |
Returns a string representing
an unique temporary file name in the system; It is recommended to use this
function whenever you create temporary files that persist only while your
weblication is running |
boolean IsSymLink(string path) |
Returns true if the path is a symlink, false otherwise |
Properties (for both Files and Folders) |
|
readonly string DateCreated |
A read-only string property that
represents the date/time when the file/folder was created ( On Unix systems,
this is the same as the date the file/folder was last accessed ) |
readonly string DateLastAccessed |
A read-only string property that
represents the date/time when the file/folder was last accessed |
readonly string
DateLastModified |
A read-only string property that
represents the date/time when the file/folder was last modified |
readonly string Drive |
( For Sash/Windows compatibility
) Read-only string property that represents the drive letter on which the
file/folder is stored. NOTE: On Unix systems returns '/'. |
readonly string ParentFolder |
A read-only property of type
Sash.FileSystem.Folder that points to the parent directory of the file/folder |
readonly string Path |
A read-only string property that
represents the directory-only portion of the path to the file/folder |
readonly string ShortName |
( For Sash/Windows compatibility
) Same as Name, but read-only |
readonly string ShortPath |
(For Sash/Windows compatibility) Same as Path |
readonly string Type |
A read-only property that is equal
to the string 'file' if the object is a File object and 'folder' if it's a
Folder object |
readonly boolean IsLocal |
A read-only boolean property that
is true if the file/folder is local to the currently running weblication |
string Name |
A string property that represents
the file name portion of the full path to the file/folder. When you change
Name, the path changes but the file/folder
will not be renamed or automatically moved |
readonly boolean IsFile |
A read-only boolean property that
is true if the object is a file |
readonly boolean IsFolder |
A read-only boolean property that
is true if the object is a folder |
readonly long
Size |
A read-only integer property that
represents the size of the file in bytes. The value of
Size is 0 for folders |
Folder-specific properties |
|
array
Files |
A read-only property that is an
array of Sash.FileSystem.File objects representing all
files in the folder |
boolean
IsRootFolder |
A read-only boolean property that
is true if the folder is at the top of the filesystem hierarchy |
array
SubFolders |
A read-only property that is an
array of Sash.FileSystem.Folder object representing
all sub-folders of the folder |
Methods (for both Files and Folders) |
|
void Copy(string target [, boolean overwrite]) |
Copy the file/folder to the destination
specified by the string target. The optional
boolean parameter overwrite specifies
whether to overwrite the target file/folder should it exist. The default for
overwrite is false |
void Delete([boolean force]) |
Delte the file/folder. The optional
boolean parameter force specifies whether
to delete the file/folder if its read-only attribute is set. The default for
force is false |
void Move(string target) |
Move the file/folder to the destination
specified by the string target |
{string, sashIFile}
file |
Either a string path, or
Sash.FileSystem.File object |
short
mode |
An optional mode parameter - one
of
Sash.FileSystem.MODE_READ,
Sash.FileSystem.MODE_WRITE or
Sash.FileSystem.MODE_APPEND |
boolean
create |
An optional boolean flag that specifies
whether the file to be created if it did not exist |
Properties |
|
readonly boolean
AtEndOfLine |
A read-only boolean property that
is true if the current character in the stream is a newline character |
readonly boolean
AtEndOfStream |
A read-only boolean property that is true if the stream has reached the end of file |
readonly long
CharSize |
Returns the size of the text stream as number of characters |
long
Position |
An integer property that represents the current position in the text stream. Setting the property changes the current position |
Methods |
|
void Close() |
Close the text stream |
string Read(long charCount) |
Return a string containing the
next charCount characters from
the text stream |
string ReadAll() |
Return a string containing all
the characters from the current position in the text stream to the end of
the file |
string ReadLine() |
Return a string containing one
full line from the text stream |
void Skip(long charCount) |
Skip the next
charCount consequetive characters from the stream |
void SkipLine() |
Skip one text line |
void Write(string text) |
Write the string
text to the stream |
void WriteBlankLines(string count) |
Write
count blank lines to the text stream |
void WriteLine(string text) |
Write the string
text to the stream, followed by a newline character |