CL_Directory Class Reference
[clanCore I/O Data]

Directory utility class. More...

#include <directory.h>

List of all members.

Static Public Member Functions

Operations

static bool create (const CL_StringRef &dir_name, bool recursive=false)
 Create directory.
static bool remove (const CL_StringRef &dir_name, bool delete_files=false, bool delete_sub_directories=false)
 Remove directory.
static bool rename (const CL_StringRef &old_name, const CL_StringRef &new_name)
 Rename directory.
static bool set_current (const CL_StringRef &dir_name)
 Change current directory.
static CL_String get_current ()
 Get current directory.
static CL_String get_appdata (const CL_StringRef &company_name, const CL_StringRef &application_name, const CL_StringRef &version, bool create_dirs_if_missing=true)
 Returns the current user's roaming application data directory.
static CL_String get_local_appdata (const CL_StringRef &company_name, const CL_StringRef &application_name, const CL_StringRef &version, bool create_dirs_if_missing=true)
 Returns the current user's local (nonroaming) application data directory.
static CL_String get_resourcedata (const CL_StringRef &application_name, const CL_StringRef &data_dir_name="Resources")
 Returns the application resource data directory.

Detailed Description

Directory utility class.


Member Function Documentation

static bool CL_Directory::create ( const CL_StringRef dir_name,
bool  recursive = false 
) [static]

Create directory.

Parameters:
dir_name = Directory name for create.
recursive = If true, function will create all directories in the path, otherwise only the last directory
Returns:
true on success or false on error.
static CL_String CL_Directory::get_appdata ( const CL_StringRef company_name,
const CL_StringRef application_name,
const CL_StringRef version,
bool  create_dirs_if_missing = true 
) [static]

Returns the current user's roaming application data directory.

In Windows, this functions returns special folder directory CSIDL_APPDATA appended with the "company_name\application_name\version" string. A typical path would be "C:\Documents and Settings\username\Application Data\company_name\application_name\version\".
In OS X, this function returns the directory "~/Library/company_name/application_name/version/".
In Linux, this function returns the directory "~/.company_name/application_name/version/".

Parameters:
company_name = Company name.
application_name = Application name.
version = Application version.
create_dirs_if_missing = If true, function will create all missing directories in the path.
Returns:
the current user's roaming application data directory.
static CL_String CL_Directory::get_current (  )  [static]

Get current directory.

Returns:
the current directory path.
static CL_String CL_Directory::get_local_appdata ( const CL_StringRef company_name,
const CL_StringRef application_name,
const CL_StringRef version,
bool  create_dirs_if_missing = true 
) [static]

Returns the current user's local (nonroaming) application data directory.

In Windows, this functions returns special folder directory CSIDL_LOCAL_APPDATA appended with the "company_name\application_name\version" string. A typical path would be "C:\Documents and Settings\username\Local Settings\Application Data\company_name\application_name\version\".
In OS X, this function returns the directory "~/Library/company_name/application_name/version/".
In Linux, this function returns the directory "~/.company_name/application_name/version/".

Parameters:
company_name = Company name.
application_name = Application name.
version = Application version.
create_dirs_if_missing = If true, function will create all missing directories in the path.
Returns:
the current user's local (nonroaming) application data directory.
static CL_String CL_Directory::get_resourcedata ( const CL_StringRef application_name,
const CL_StringRef data_dir_name = "Resources" 
) [static]

Returns the application resource data directory.

In Windows, this function returns a data_dir_name subdirectory located at the executable. If the executable path is "C:\Program Files\My Application\MyApp.exe", then it will return the path "C:\Program Files\My Application\data_dir_name\".
In OS X, this function returns a "Resources" subdirectory inside the application bundle. For example, if the application executable path is "/Applications/MyApplication.app/Contents/MacOS/MyApplication", then it will return "/Applications/MyApplication.app/Contents/Resources/". If the executable is not in an application bundle, it will use the same behavior as in Windows; that is, it will return a data_dir_name subdirectory next to the executable.
In Linux, this function will return the directory "../share/application_name/" relative to the executable, so if it is located in "/usr/bin" it will return "/usr/share/application_name/"

Parameters:
application_name = Application name.
data_dir_name = Data directory name.
Returns:
the application resource data directory.
static bool CL_Directory::remove ( const CL_StringRef dir_name,
bool  delete_files = false,
bool  delete_sub_directories = false 
) [static]

Remove directory.

Parameters:
dir_name = Directory name for delete.
delete_files = If true, function will delete files.
delete_sub_directories = If true, function will delete subdirectories too.
Returns:
true on success or false on error.
static bool CL_Directory::rename ( const CL_StringRef old_name,
const CL_StringRef new_name 
) [static]

Rename directory.

Parameters:
old_name = Old name of the directory to be renamed.
new_name = New directory name.
Returns:
true on success or false on error.
static bool CL_Directory::set_current ( const CL_StringRef dir_name  )  [static]

Change current directory.

Parameters:
dir_name = Directory name to change to.
Returns:
true on success or false on error.

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