The Filesys class is designed for file system manipulation.
Synopsis
#include <lyric/Filesys.hpp>
class Filesys
{
public:
#include <lyric/Filesys.Permission.hpp>
#include <lyric/Filesys.Owner.hpp>
#include <lyric/Filesys.Entry.hpp>
#include <lyric/Filesys.File.hpp>
#include <lyric/Filesys.Link.hpp>
#include <lyric/Filesys.Symlink.hpp>
#include <lyric/Filesys.Directory.hpp>
#include <lyric/Filesys.Devchar.hpp>
#include <lyric/Filesys.Devblock.hpp>
#include <lyric/Filesys.Fifo.hpp>
#include <lyric/Filesys.Socket.hpp>
EXI ~Filesys ();
EXI Filesys ();
EXI Filesys (const Filesys& fs);
EXI Filesys& operator = (const Filesys& fs);
EXI Path cwd () const;
EXI bool exist (const Path& path) const;
EXI bool access (const ::File::Access& mode, const Path& path) const;
EXI ::File::Size size (const Path& path) const;
EXI Entry::Type type (const Path& path) const;
EXI void create (const Entry& entry)
throw (Exception::Filesys::Create);
EXI void create (::File& file)
throw (Exception::File::Create);
EXI void create (::File& file, const ::File::Permission& perm)
throw (Exception::File::Create);
EXI void erase (const Path& path)
throw (Exception::File::Remove);
EXI void remove (const Path& path)
throw (Exception::File::Remove);
EXI void unlink (const Path& path)
throw (Exception::File::Remove);
// To split documentation about each entry type
private:
EXI void create (const File& entry)
throw (Exception::Filesys::Create);
EXI void create (const Directory& entry)
throw (Exception::Filesys::Create);
void create (const Link& entry)
throw (Exception::Filesys::Create);
void create (const Symlink& entry)
throw (Exception::Filesys::Create);
void create (const Devchar& entry)
throw (Exception::Filesys::Create);
void create (const Devblock& entry)
throw (Exception::Filesys::Create);
void create (const Fifo& entry)
throw (Exception::Filesys::Create);
void create (const Socket& entry)
throw (Exception::Filesys::Create);
};
Description
-
˜Filesys () -
-
void create (const Filesys::File& entry) -
Creates the regular file described in entry in this filesystem.
-
Exception::Filesys::Create
- is thrown if the file creation fails.
The exception’s reason field (exception.reason()) describes the reason of
failure (Exception::Filesys:: prefix must be added):
-
Exist
- if entry.path() already exists.
-
Permission
- if the parent directory does not allow write permission to
the process, or one of the directories in entry.path() did not allow
search (execute) permission.
-
Name
- if entry.path() is too long.
-
Incomplete
- if a directory component in entry.path() does not exist
or is a dangling symbolic link.
-
Directory
- if a component used as a directory in entry.path() is not,
in fact, a directory.
-
Write
- if entry.path() refers to a file on a read-only filesystem.
-
Loop
- if too many symbolic links were encountered in resolving
entry.path().
-
Space
- if the device containing entry.path() has no room for the new
file, or the user’s disk quota is exhausted.
-
Memory
- if insufficent kernel memory was available.
-
void create (const Filesys::Directory& entry) -
Create the directory described in entry in this file system.
-
Exception::Filesys::Create
- is thrown if the directory creation fails.
The exception’s reason field (exception.reason()) describes the reason of
failure (Exception::Filesys:: prefix must be added):
-
Support
- if the filesystem containing entry.path() does not support
the creation of directories.
-
Exist
- if entry.path() already exists (not necessarily as a directory).
This includes the case where entry.path() is a symbolic link,
dangling or not.
-
Permission
- if the parent directory does not allow write permission to
the process, or one of the directories in entry.path() did not allow
search (execute) permission.
-
Name
- if entry.path() is too long.
-
Incomplete
- if a directory component in entry.path() does not exist
or is a dangling symbolic link.
-
Directory
- if a component used as a directory in entry.path() is not,
in fact, a directory.
-
Memory
- if insufficent kernel memory was available.
-
Write
- if entry.path() refers to a directory on a read-only filesystem.
-
Loop
- if too many symbolic links were encountered in resolving
entry.path().
-
Space
- if the device containing entry.path() has no room for the new
directory, or the user’s disk quota is exhausted.
-
void create (const Filesys::Link& entry) -
Creates the link described in entry in this file system.
-
Exception::Filesys::Create
- is thrown if the link creation fails.
The exception’s path field (exception.path()) contains the link as a string of
the form "entry.path() -> entry.link()". This string can be tokenized (see
the String class, Section 2.9) to get the two parts, using delimiter " ->
".
The exception’s reason field (exception.reason()) describes the reason of
failure (Exception::Filesys:: prefix must be added):
-
Device
- if entry.path() and entry.link() are not on the same file
system.
-
Support
- if the file system containing entry.path() and entry.link()
does not support the creation of hard links.
-
Permission
- if the parent directory does not allow write permission
to the process, or one of the directories in entry.path() or
entry.link() did not allow search (execute) permission.
-
Name
- if entry.path() or entry.link() is too long.
-
Incomplete
- if a directory component in entry.path() or entry.path()
does not exist or is a dangling symbolic link.
-
Directory
- if a component used as a directory in entry.path() or
entry.path() is not, in fact, a directory.
-
Memory
- if insufficent kernel memory was available.
-
Write
- if entry.path() refers to a file on a read-only filesystem.
-
Exist
- if entry.path() already exists.
-
Limit
- if entry.link() already has the maximum number of links to
it.
-
Loop
- if too many symbolic links were encountered in resolving
entry.path() or entry.link().
-
Space
- if the device containing entry.path() has no room for the new
file, or the user’s disk quota is exhausted.
-
Unknown
- if an unspecified I/O error occured.
-
void create (const Filesys::Symlink& entry) -
Creates the link described in entry in this file system.
-
Exception::Filesys::Create
- is thrown if the symbolic link creation fails.
The exception’s path field (exception.path()) contains the link as a string of
the form "entry.path() -> entry.link()". This string can be tokenized (see
the String class, Section 2.9) to get the two parts, using delimiter " ->
".
The exception’s reason field (exception.reason()) describes the reason of
failure (Exception::Filesys:: prefix must be added):
-
Support
- if the file system containing entry.path() and entry.link()
does not support the creation of hard links.
-
Permission
- if the parent directory does not allow write permission to
the process, or one of the directories in entry.path() did not allow
search (execute) permission.
-
Name
- if entry.path() is too long.
-
Incomplete
- if a directory component in entry.path() does not exist
or is a dangling symbolic link or entry.link() is the empty string.
-
Directory
- if a component used as a directory in entry.path() is not,
in fact, a directory.
-
Memory
- if insufficent kernel memory was available.
-
Write
- if entry.path() refers to a file on a read-only filesystem.
-
Exist
- if entry.path() already exists.
-
Loop
- if too many symbolic links were encountered in resolving
entry.path().
-
Space
- if the device containing entry.path() has no room for the new
file, or the user’s disk quota is exhausted.
-
Unknown
- if an unspecified I/O error occured.
-
void create (const Filesys::Devchar& entry) -
Creates the character device node described by entry in this file system.
-
Exception::Filesys::Create
- is thrown if the character device node creation
fails.
The exception’s reason field (exception.reason()) describes the reason of
failure (Exception::Filesys:: prefix must be added):
-
Support
- if the caller is not the super user or if the file system specified
in entry.path() does not support the creation of character device
nodes.
-
Exist
- if entry.path() already exists.
-
Permission
- if the parent directory does not allow write permission to
the process, or one of the directories in entry.path() did not allow
search (execute) permission.
-
Name
- if entry.path() is too long.
-
Incomplete
- if a directory component in entry.path() does not exist
or is a dangling symbolic link.
-
Directory
- if a component used as a directory in entry.path() is not,
in fact, a directory.
-
Memory
- if insufficent kernel memory was available.
-
Write
- if entry.path() refers to a file on a read-only filesystem.
-
Loop
- if too many symbolic links were encountered in resolving
entry.path().
-
Space
- if the device containing entry.path() has no room for the new
file, or the user’s disk quota is exhausted.
-
void create (const Filesys::Devblock& entry) -
Creates the block device node described by entry in this file system.
-
Exception::Filesys::Create
- is thrown if the block device node creation
fails.
The exception’s reason field (exception.reason()) describes the reason of
failure (Exception::Filesys:: prefix must be added):
-
Support
- if the caller is not the super user or if the file system specified
in entry.path() does not support the creation of block device nodes.
-
Exist
- if entry.path() already exists.
-
Permission
- if the parent directory does not allow write permission to
the process, or one of the directories in entry.path() did not allow
search (execute) permission.
-
Name
- if entry.path() is too long.
-
Incomplete
- if a directory component in entry.path() does not exist
or is a dangling symbolic link.
-
Directory
- if a component used as a directory in entry.path() is not,
in fact, a directory.
-
Memory
- if insufficent kernel memory was available.
-
Write
- if entry.path() refers to a file on a read-only filesystem.
-
Loop
- if too many symbolic links were encountered in resolving
entry.path().
-
Space
- if the device containing entry.path() has no room for the new
file, or the user’s disk quota is exhausted.
-
void create (const Filesys::Fifo& entry) -
Creates the fifo node described by entry in this file system.
-
Exception::Filesys::Create
- is thrown if the fifo node creation fails.
The exception’s reason field (exception.reason()) describes the reason of
failure (Exception::Filesys:: prefix must be added):
-
Support
- if the caller is not the super user or if the file system specified
in entry.path() does not support the creation of fifo nodes.
-
Exist
- if entry.path() already exists.
-
Permission
- if the parent directory does not allow write permission to
the process, or one of the directories in entry.path() did not allow
search (execute) permission.
-
Name
- if entry.path() is too long.
-
Incomplete
- if a directory component in entry.path() does not exist
or is a dangling symbolic link.
-
Directory
- if a component used as a directory in entry.path() is not,
in fact, a directory.
-
Memory
- if insufficent kernel memory was available.
-
Write
- if entry.path() refers to a file on a read-only filesystem.
-
Loop
- if too many symbolic links were encountered in resolving
entry.path().
-
Space
- if the device containing entry.path() has no room for the new
file, or the user’s disk quota is exhausted.