A file system item. Can be a file or directory.
When using this and other FS APIs, it's common to deal with paths. Unless noted, a path can be either absolute or relative (to working directory of the current process). A path comprises of one or more sections, and in case of relative path the path can be even empty. These section are separated by a path separator, which can differ based on the OS. However, Julian recognizes both '/' (POSIX) and '' (Windows) as the equally legal path separator.
Known Extensions
Type | Name | Signature |
---|---|---|
method | create | public bool create() |
method | delete | public bool delete() |
method | exists | public bool exists() |
method | getName | public String getName() |
method | getPath | public String getPath() |
method | isFile | public bool isFile() |
method | move | public bool move(System.IO.Directory) |
method | rename | public bool rename(string) |
method E | relocate | public bool relocate(System.IO.Directory, string) |
public bool create()
Create this item.
Returns
public bool delete()
Delete this item.
Returns
public bool exists()
Whether this item exist on file system.
Returns
public String getName()
Get the name of this item. This is only the simple name (with extension part) under the path.
Returns
public String getPath()
Get the absolute path of this item. This doesn't include the name.
Returns
public bool isFile()
Whether this item is a file
Returns
public bool move(Directory newDir)
Move this item to another directory.
Unlike a few file systems where the move command/API serves dual purpose, Julian splits the semantics between move and rename. Rename operation is only for renaming without moving around the file, while this method may only be used to move an item from one directory to another without changing its name. The obvious implication of this division is that for the move operation, the destination must be a valid directory, and there must be no item in that directory that is already possessing the same name. In any of these cases this method returns false. Moving to the same directory is allowed and implemented trivially by returning true directly.
To move an item and change its name, use extension method relocate().
Parameters
Returns
Throws
public bool rename(string newName)
Rename this item while remaining in the same directory.
Unlike a few file systems where the move command/API serves dual purpose, Julian splits the semantics between move and rename. Move operation may only be used to move an item from one directory to another without changing its name, while this method is only for renaming without moving around the file. The obvious implication of this division is that for the rename operation, the new name must not contain file system separator, and there must be no item within the same directory that is already possessing the same name. In any of these cases this method returns false.
To move an item and change its name, use extension method relocate().
Parameters
Returns
Throws