FileFunctions Namespace Reference

Some file functions for general use. More...


Functions

string GetApplicationDirectory ()
 Returns application directory ended by '/'.
string GetCurrentWorkingDirectory ()
 Returns current working directory ended by '/'.
string GetFileNameFromPath (const string &path)
 Returns file name from the given path.
bool FileExists (const string &file)
 Returns true if the selected file exists.
bool DirectoryExists (const string &directory)
 Returns true if the selected directory exists.
bool IsAbsolutePath (const string &path)
 Returns true if the selected path (address) is absolute.
string CreateProperFilePath (const string &file)
 Converts selected file path to a "proper" one (see description for more info).
string CreateProperDirectoryPath (const string &directory)
 Converts selected directory path to a "proper" one (see description for more info).
void SetProgramStartedPath (string startedPath)
 Sets 'program started path'.
string GetProgramStartedPath ()
 Returns 'program started path' (path from where the program was started).

Variables

string programStartedPath


Detailed Description

Some file functions for general use.

Function Documentation

string FileFunctions::GetApplicationDirectory (  ) 

Returns application directory ended by '/'.

Example: /home/user/apps/applicationXYZ/

string FileFunctions::GetCurrentWorkingDirectory (  ) 

Returns current working directory ended by '/'.

Example: /home/user/apps/applicationXYZ/work/

string FileFunctions::GetFileNameFromPath ( const string &  path  ) 

Returns file name from the given path.

Parameters:
path Selected path
If the given path contains no file name (e.g. it's a directory), it returns empty string.

bool FileFunctions::FileExists ( const string &  file  ) 

Returns true if the selected file exists.

Parameters:
file File that has to be tested

bool FileFunctions::DirectoryExists ( const string &  directory  ) 

Returns true if the selected directory exists.

Parameters:
directory Directory that has to be tested

bool FileFunctions::IsAbsolutePath ( const string &  path  ) 

Returns true if the selected path (address) is absolute.

Parameters:
path Path that has to be tested

string FileFunctions::CreateProperFilePath ( const string &  file  ) 

Converts selected file path to a "proper" one (see description for more info).

Parameters:
file File (path) that has to be tested
This function should be called before opening a file from the application, because of possibility that an user will run the application from another path (insted of running it directly from the application directory). If the selected file pah exists, it returns it without change, but if it doesn't exist it will try to get existence of the file according to the application directory. If it fails now, it will return original file path, so you have to test the existence of the file anyway (it's more suitable for error messages and exceptions handling).

string FileFunctions::CreateProperDirectoryPath ( const string &  directory  ) 

Converts selected directory path to a "proper" one (see description for more info).

Parameters:
directory Directory that has to be tested
This function is similar to CreateProperFilePath(), but it works with directories instead of files.

void FileFunctions::SetProgramStartedPath ( string  startedPath  ) 

Sets 'program started path'.

Parameters:
startedPath Path from where the program was started

string FileFunctions::GetProgramStartedPath (  ) 

Returns 'program started path' (path from where the program was started).


Variable Documentation

string FileFunctions::programStartedPath [static]


Generated on Sun Apr 29 11:46:11 2007 for IPP/ICP2007 by  doxygen 1.4.7