FileSystem for Windows NT/2000.
You should also use this class as a template to write your local implementation
Some native PHP filesystem specific methods are abstracted here as well. Anyway
you must always use this methods via a PhingFile object (that by nature uses the
*FileSystem drivers to access the real filesystem via this class using natives.
FIXME:
- Error handling reduced to min fallthrough runtime exceptions
more precise errorhandling is done by the PhingFile class
Methods
__construct()
__construct()
Inherited
| inherited_from |
\Win32FileSystem::__construct() |
private
_driveIndex($d)
Inherited
| inherited_from |
\Win32FileSystem::_driveIndex() |
Parameters
$d
_getDrive()
_getDrive($path)
Inherited
| inherited_from |
\Win32FileSystem::_getDrive() |
Parameters
$path
_getDriveDirectory()
_getDriveDirectory($drive)
Inherited
| inherited_from |
\Win32FileSystem::_getDriveDirectory() |
Parameters
$drive
_getUserPath()
_getUserPath()
Inherited
| inherited_from |
\Win32FileSystem::_getUserPath() |
private
_isPharArchive($strPath)
Inherited
| inherited_from |
\Win32FileSystem::_isPharArchive() |
Parameters
$strPath
_nativeListRoots()
_nativeListRoots()
Inherited
| inherited_from |
\Win32FileSystem::_nativeListRoots() |
Whether file can be deleted.
canDelete(\PhingFile $f) : boolean
Inherited
| inherited_from |
\FileSystem::canDelete() |
| inherited_from |
\Win32FileSystem::canDelete() |
Parameters
Returns
boolean
canonicalize filename by checking on disk
canonicalize(string $strPath) : mixed
Inherited
| inherited_from |
\FileSystem::canonicalize() |
| inherited_from |
\Win32FileSystem::canonicalize() |
Parameters
$strPath
string
Returns
mixedCanonical path or false if the file doesn't exist.
Check whether the file or directory denoted by the given abstract
pathname may be accessed by this process.
checkAccess(\PhingFile $f, boolean $write)
Inherited
If the second argument is
false, then a check for read access is made; if the second
argument is true, then a check for write (not read-write)
access is made. Return false if access is denied or an I/O error
occurs.
| inherited_from |
\FileSystem::checkAccess() |
| inherited_from |
\Win32FileSystem::checkAccess() |
Parameters
$write
boolean
Change the group on a file or directory.
chgrp(string $pathname, string $group) : void
Inherited
| inherited_from |
\FileSystem::chgrp() |
| inherited_from |
\Win32FileSystem::chgrp() |
Parameters
$pathname
stringPath and name of file or directory.
$group
stringThe group of the file or directory. See http://us.php.net/chgrp
Exceptions
Change the permissions on a file or directory.
chmod(string $pathname, int $mode) : void
Inherited
| inherited_from |
\FileSystem::chmod() |
| inherited_from |
\Win32FileSystem::chmod() |
Parameters
$pathname
stringPath and name of file or directory.
$mode
intThe mode (permissions) of the file or
directory. If using octal add leading 0. eg. 0777.
Mode is affected by the umask system setting.
Exceptions
Change the ownership on a file or directory.
chown(string $pathname, string $user) : void
Inherited
| inherited_from |
\FileSystem::chown() |
| inherited_from |
\Win32FileSystem::chown() |
Parameters
$pathname
stringPath and name of file or directory.
$user
stringThe user name or number of the file or directory. See http://us.php.net/chown
Exceptions
compares file paths lexicographically
compare(\PhingFile $f1, \PhingFile $f2)
Inherited
| inherited_from |
\Win32FileSystem::compare() |
Parameters
Compare the modified time of two files.
compareMTimes(\file1 $file1, \file2 $file2) : \Int.
Inherited
| inherited_from |
\FileSystem::compareMTimes() |
| inherited_from |
\Win32FileSystem::compareMTimes() |
Parameters
$file1
\file1String. Path and name of file1.
$file2
\file2String. Path and name of file2.
Exceptions
\Exception |
- if cannot get modified time of either file. |
Returns
\Int.1 if file1 is newer.
-1 if file2 is newer.
0 if files have the same time.
Err object on failure.
Copy a file.
copy(\PhingFile $src, \PhingFile $dest) : void
Inherited
| inherited_from |
\FileSystem::copy() |
| inherited_from |
\Win32FileSystem::copy() |
Parameters
$dest
\PhingFileDestination path and name of new file.
Exceptions
Copy a file, or recursively copy a folder and its contents
copyr(string $source, string $dest) : bool
Inherited
Parameters
$source
stringSource path
$dest
stringDestination path
Returns
boolReturns TRUE on success, FALSE on failure
Create a new directory denoted by the given abstract pathname,
returning true if and only if the operation succeeds.
createDirectory(\PhingFile $f, int $mode) : boolean
Inherited
NOTE: umask() is reset to 0 while executing mkdir(), and restored afterwards
| inherited_from |
\FileSystem::createDirectory() |
| inherited_from |
\Win32FileSystem::createDirectory() |
Parameters
$mode
int
Returns
boolean
Create a new empty file with the given pathname.
createNewFile(string $strPathname) : boolean
Inherited
Return
true if the file was created and false if a
file or directory with the given pathname already exists. Throw an
IOException if an I/O error occurs.
| inherited_from |
\FileSystem::createNewFile() |
| inherited_from |
\Win32FileSystem::createNewFile() |
Parameters
$strPathname
stringPath of the file to be created.
Exceptions
Returns
boolean
Delete the file or directory denoted by the given abstract pathname,
returning true if and only if the operation succeeds.
delete(\PhingFile $f, boolean $recursive) : void
Inherited
| inherited_from |
\FileSystem::delete() |
| inherited_from |
\Win32FileSystem::delete() |
Parameters
$recursive
boolean
Arrange for the file or directory denoted by the given abstract
pathname to be deleted when Phing::shutdown is called, returning
true if and only if the operation succeeds.
deleteOnExit(\PhingFile $f)
Inherited
| inherited_from |
\FileSystem::deleteOnExit() |
| inherited_from |
\Win32FileSystem::deleteOnExit() |
Parameters
Exceptions
Post-process the given URI path string if necessary.
fromURIPath($strPath)
Inherited
This is used on
win32, e.g., to transform "/c:/foo" into "c:/foo". The path string
still has slash separators; code in the PhingFile class will translate them
after this method returns.
| inherited_from |
\Win32FileSystem::fromURIPath() |
Parameters
$strPath
Return the simple boolean attributes for the file or directory denoted
by the given abstract pathname, or zero if it does not exist or some
other I/O error occurs.
getBooleanAttributes(\PhingFile $f)
Inherited
| inherited_from |
\FileSystem::getBooleanAttributes() |
| inherited_from |
\Win32FileSystem::getBooleanAttributes() |
Parameters
Return the parent pathname string to be used when the parent-directory
argument in one of the two-argument PhingFile constructors is the empty
pathname.
getDefaultParent()
Inherited
| inherited_from |
\Win32FileSystem::getDefaultParent() |
Static method to return the FileSystem singelton representing
this platform's local filesystem driver.
getFileSystem() : \FileSystem
InheritedStatic
| inherited_from |
\FileSystem::getFileSystem() |
| inherited_from |
\Win32FileSystem::getFileSystem() |
Exceptions
Returns
Return the time at which the file or directory denoted by the given
abstract pathname was last modified, or zero if it does not exist or
some other I/O error occurs.
getLastModifiedTime(\PhingFile $f) : int
Inherited
| inherited_from |
\FileSystem::getLastModifiedTime() |
| inherited_from |
\Win32FileSystem::getLastModifiedTime() |
Parameters
Exceptions
Returns
int
Return the length in bytes of the file denoted by the given abstract
pathname, or zero if it does not exist, is a directory, or some other
I/O error occurs.
getLength(\PhingFile $f) : int
Inherited
| inherited_from |
\FileSystem::getLength() |
| inherited_from |
\Win32FileSystem::getLength() |
Parameters
Exceptions
Returns
int
Return the local filesystem's path-separator character.
getPathSeparator()
Inherited
| inherited_from |
\Win32FileSystem::getPathSeparator() |
Return the local filesystem's name-separator character.
getSeparator()
Inherited
| inherited_from |
\Win32FileSystem::getSeparator() |
Tell whether or not the given abstract pathname is absolute.
isAbsolute(\PhingFile $f)
Inherited
| inherited_from |
\Win32FileSystem::isAbsolute() |
Parameters
isLetter()
isLetter($c)
Inherited
| inherited_from |
\Win32FileSystem::isLetter() |
Parameters
$c
isSlash()
isSlash($c)
Inherited
| inherited_from |
\Win32FileSystem::isSlash() |
Parameters
$c
List the elements of the directory denoted by the given abstract
pathname.
listDir(\PhingFile $f)
Inherited
Return an array of strings naming the elements of the
directory if successful; otherwise, return
null
.
| inherited_from |
\FileSystem::listDir() |
| inherited_from |
\Win32FileSystem::listDir() |
Parameters
List the available filesystem roots, return array of PhingFile objects
listRoots()
Inherited
| inherited_from |
\Win32FileSystem::listRoots() |
Exceptions
returns the contents of a directory in an array
lister($f)
Inherited
| inherited_from |
\Win32FileSystem::lister() |
Parameters
$f
Locks a file and throws an Exception if this is not possible.
lock(\PhingFile $f) : void
Inherited
| inherited_from |
\FileSystem::lock() |
| inherited_from |
\Win32FileSystem::lock() |
Parameters
Exceptions
Check that the given pathname is normal.
normalize(string $strPath) : string
Inherited
If not, invoke the real
normalizer on the part of the pathname that requires normalization.
This way we iterate through the whole pathname string only once.
| inherited_from |
\Win32FileSystem::normalize() |
Parameters
$strPath
string
Returns
string
A normal Win32 pathname contains no duplicate slashes, except possibly
for a UNC prefix, and does not end with a slash.
normalizePrefix($strPath, $len, $sb)
Inherited
It may be the empty
string. Normalized Win32 pathnames have the convenient property that
the length of the prefix almost uniquely identifies the type of the path
and whether it is absolute or relative:
0 relative to both drive and directory
1 drive-relative (begins with '\')
2 absolute UNC (if first char is '\'), else directory-relative (has form "z:foo")
3 absolute local pathname (begins with "z:\")
| inherited_from |
\Win32FileSystem::normalizePrefix() |
Parameters
$strPath
$len
$sb
Compute the length of this pathname string's prefix.
prefixLength($strPath)
Inherited
The pathname
string must be in normal form.
| inherited_from |
\Win32FileSystem::prefixLength() |
Parameters
$strPath
Rename the file or directory denoted by the first abstract pathname to
the second abstract pathname, returning true if and only if
the operation succeeds.
rename(\PhingFile $f1, \PhingFile $f2) : void
Inherited
| inherited_from |
\FileSystem::rename() |
| inherited_from |
\Win32FileSystem::rename() |
Parameters
Exceptions
Resolve the child pathname string against the parent.
resolve(string $parent, string $child)
Inherited
Both strings must be in normal form, and the result
will be a string in normal form.
| inherited_from |
\Win32FileSystem::resolve() |
Parameters
$parent
string
$child
string
Resolve the given abstract pathname into absolute form.
resolveFile(\PhingFile $f)
Inherited
Invoked by the
getAbsolutePath and getCanonicalPath methods in the PhingFile class.
| inherited_from |
\Win32FileSystem::resolveFile() |
Parameters
Delete an empty directory OR a directory and all of its contents.
rmdir(\dir $dir, \children $children) : void
Inherited
| inherited_from |
\FileSystem::rmdir() |
| inherited_from |
\Win32FileSystem::rmdir() |
Parameters
$dir
\dirString. Path and/or name of directory to delete.
$children
\childrenBoolean. False: don't delete directory contents.
True: delete directory contents.
Set the last-modified time of the file or directory denoted by the
given abstract pathname returning true if and only if the
operation succeeds.
setLastModifiedTime(\PhingFile $f, int $time) : void
Inherited
| inherited_from |
\FileSystem::setLastModifiedTime() |
| inherited_from |
\Win32FileSystem::setLastModifiedTime() |
Parameters
$time
int
Exceptions
Mark the file or directory denoted by the given abstract pathname as
read-only, returning <code>true</code> if and only if the operation
succeeds.
setReadOnly(\PhingFile $f)
Inherited
| inherited_from |
\Win32FileSystem::setReadOnly() |
Parameters
Exceptions
slashify()
slashify($p)
Inherited
| inherited_from |
\Win32FileSystem::slashify() |
Parameters
$p
Symbolically link a file to another name.
symlink(string $target, string $link) : void
Inherited
Currently symlink is not implemented on Windows. Don't use if the application is to be portable.
| inherited_from |
\FileSystem::symlink() |
| inherited_from |
\Win32FileSystem::symlink() |
Parameters
$target
stringPath and/or name of file to link.
$link
stringPath and/or name of link to be created.
Set the modification and access time on a file to the present time.
touch(string $file, int $time) : void
Inherited
| inherited_from |
\FileSystem::touch() |
| inherited_from |
\Win32FileSystem::touch() |
Parameters
$file
stringPath and/or name of file to touch.
$time
int
Set the umask for file and directory creation.
umask(\mode $mode) : void
Inherited
| inherited_from |
\FileSystem::umask() |
| inherited_from |
\Win32FileSystem::umask() |
Parameters
$mode
\modeInt. Permissions ususally in ocatal. Use leading 0 for
octal. Number between 0 and 0777.
Exceptions
\Exception |
if there is an error performing operation. |
Delete a file.
unlink(string $file) : void
Inherited
| inherited_from |
\FileSystem::unlink() |
| inherited_from |
\Win32FileSystem::unlink() |
Parameters
$file
stringPath and/or name of file to delete.
Exceptions
Unlocks a file and throws an IO Error if this is not possible.
unlock(\PhingFile $f) : void
Inherited
| inherited_from |
\FileSystem::unlock() |
| inherited_from |
\Win32FileSystem::unlock() |
Parameters
Exceptions
_access()
_access($path)
Inherited
| inherited_from |
\Win32FileSystem::_access() |
Parameters
$path
Normalize the given pathname, whose length is len, starting at the given
offset; everything before this offset is already normal.
normalizer($strPath, $len, $offset)
Inherited
| inherited_from |
\Win32FileSystem::normalizer() |
Parameters
$strPath
$len
$offset
Properties
$altSlash
Inherited
| inherited_from |
\Win32FileSystem::$$altSlash |
$semicolon
Inherited
| inherited_from |
\Win32FileSystem::$$semicolon |
$slash
Inherited
| inherited_from |
\Win32FileSystem::$$slash |
$driveDirCache
Inherited
| inherited_from |
\Win32FileSystem::$$driveDirCache |
$fs : \FileSystem
Inherited
| inherited_from |
\FileSystem::$$fs |
| inherited_from |
\Win32FileSystem::$$fs |
Constants
BA_DIRECTORY
BA_DIRECTORY : int
Inherited
| inherited_from |
\FileSystem::BA_DIRECTORY |
| inherited_from |
\Win32FileSystem::BA_DIRECTORY |
BA_EXISTS
BA_EXISTS : int
Inherited
| inherited_from |
\FileSystem::BA_EXISTS |
| inherited_from |
\Win32FileSystem::BA_EXISTS |
BA_HIDDEN
BA_HIDDEN : int
Inherited
| inherited_from |
\FileSystem::BA_HIDDEN |
| inherited_from |
\Win32FileSystem::BA_HIDDEN |
BA_REGULAR
BA_REGULAR : int
Inherited
| inherited_from |
\FileSystem::BA_REGULAR |
| inherited_from |
\Win32FileSystem::BA_REGULAR |