Directory utility class. More...
#include <directory.h>
Static Public Member Functions | |
Operations | |
| static bool | create (const CL_String &dir_name) |
| Create directory. | |
| static bool | remove (const CL_String &dir_name, bool delete_files=false, bool delete_sub_directories=false) |
| Remove directory. | |
| static bool | set_current (const CL_String &path) |
| 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) |
| Returns the application resource data directory. | |
Directory utility class.
| static bool CL_Directory::create | ( | const CL_String & | dir_name | ) | [static] |
Create directory.
| dir_name | = Directory name for create. |
| 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 application_name 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/application_name/".
In Linux, this function returns the directory "~/.appdata/application_name/".
| static CL_String CL_Directory::get_current | ( | ) | [static] |
Get current directory.
| 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 application_name 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/application_name/".
In Linux, this function returns the directory "~/.local_appdata/application_name/".
| static CL_String CL_Directory::get_resourcedata | ( | const CL_StringRef & | application_name | ) | [static] |
Returns the application resource data directory.
In Windows, this function returns a "Resources" subdirectory located at the executable. If the executable path is "C:\Program Files\My Application\MyApp.exe", then it will return the path "C:\Progam Files\My Application\Resources\".
In OS X, this function returns the Resources 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 "Resources" 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/"
| static bool CL_Directory::remove | ( | const CL_String & | dir_name, | |
| bool | delete_files = false, |
|||
| bool | delete_sub_directories = false | |||
| ) | [static] |
Remove directory.
| dir_name | = Directory name for delete. | |
| delete_files | = If true, function will delete files. | |
| delete_sub_directories | = If true, function will delete sub directories too. |
| static bool CL_Directory::set_current | ( | const CL_String & | path | ) | [static] |
Change current directory.
| path | = Directory name to change to. |
1.7.1