oaFSComponent Class Reference

Inheritance diagram for oaFSComponent:

oaDir oaFile


Public Methods

 oaFSComponent (const oaString &nameIn)
virtual ~oaFSComponent ()
void destroy ()
void rename (const oaString &newName)
virtual oaBoolean exists () const
oaBoolean isFile () const
oaBoolean isDir () const
oaBoolean isReadable () const
oaBoolean isWritable () const
oaBoolean isInCWD () const
oaBoolean isSameDiskFile (const oaFSComponent &file) const
oaBoolean isSymbolicLink () const
const oaStringgetName () const
void getFullName (oaString &pathName) const

Detailed Description

The FSComponent class implements a file system component, which may be either a file or a directory.


Constructor & Destructor Documentation

oaFSComponent::oaFSComponent const oaString &    nameIn
 

This is the constructor for the oaFSComponent class.

Parameters:
nameIn Path to the file system component. The path may be relative to the current working directory, or a fully qualified path name.

oaFSComponent::~oaFSComponent   [inline, virtual]
 

This is the destructor for the oaFSComponent class.


Member Function Documentation

void oaFSComponent::destroy  
 

This function removes this file system component from the disk. If the component is a directory, it will remove the contents of the directory and then delete the directory itself.

Exceptions:
oacUnableToRemove 

oaBoolean oaFSComponent::exists   const [virtual]
 

This function returns true if the file system component associated with the name exists on disk.

Reimplemented in oaFile, and oaDir.

void oaFSComponent::getFullName oaString &    pathName const
 

This function returns the full path to the library relative to the local host. This is also called the "real" name or the "canonicalized" name.

Parameters:
pathName Reference to string to return the pathName in.
Exceptions:
oacGetFullPathFailed 

const oaString & oaFSComponent::getName   const [inline]
 

This function returns the name (path) of this file system component.

oaBoolean oaFSComponent::isDir   const
 

This function returns true if this file system component is a directory.

oaBoolean oaFSComponent::isFile   const
 

This function returns true if this file system component is a file (not a directory).

oaBoolean oaFSComponent::isInCWD   const
 

This function checks the file system component given by path to see if it is in the current working directory. Note that a file that is a link in the CWD will return true.

This is the algorithm used:

1) Remove the file portion of the oaFSComponent name in order to get the directory. 2) Get the current working directory. 3) Use isSameDiskFile() to compare the two directories.

oaBoolean oaFSComponent::isReadable   const
 

This function returns true if the file system component is readable by the calling application.

oaBoolean oaFSComponent::isSameDiskFile const oaFSComponent &    fileComponent const
 

This function compares the current file system component to the given system file component in order to determine if they point to the same device and inode and therefore refer to the same file. Returns true if the device and inode of each component are the same. Returns false if the device or inode are not the same, or if either component cannot be opened.

Parameters:
fileComponent File system component to check this one against.

oaBoolean oaFSComponent::isSymbolicLink   const
 

This function returns true if the file system component is a symbolic link. On platforms that do not support symbolic links, it always returns false.

oaBoolean oaFSComponent::isWritable   const
 

This function returns true if the file system component is writable, respectively. Note that the isWritable check requires the component to exist on disk.

void oaFSComponent::rename const oaString &    newName
 

This function renames this file system component to the specified newName. If the object is a file, the file must not be open at the time, since the handles will still point to the old file. If running on Windows OS, an exception is thrown if a file system component with the new name already exists.

Parameters:
newName New name path. The path may be relative to the current working directory, or a fully qualified path name.
Exceptions:
oacUnableToRemove 


The documentation for this class was generated from the following files:

Return to top of page