#include <ax/ax_utils.h>
Public Member Functions | |
AxFileUtilities () | |
Constructor. | |
Static Public Member Functions | |
static wxString | GetDocumentDirectory () |
Get a suitable directory for putting documents by default. | |
static wxString | GetUserAppDataDirectory (const wxString &appName) |
Get the application data directory for the current user. | |
static wxString | AppendPaths (const wxString &p1, const wxString &p2, const wxString &sep=wxFILE_SEP_PATH) |
Append paths without duplicating the separator. | |
static bool | MkDirRecursively (const wxString &path) |
Make sure the folder exists, otherwise create recursively. | |
static bool | RemoveDirRecursively (const wxString &path) |
Remove dir recursively. | |
static bool | Chmod (const wxString &path, int mode, bool addMode=false) |
Change the Unix file mode. | |
static int | GetFileMode (const wxString &path) |
Get the Unix file mode. If path is empty, get the default mode for a new file. | |
static bool | FindAndChmod (const wxString &searchPath, const wxString &filename, int mode, bool addMode=false) |
Find the given file under the a path and change its mode. | |
static bool | CopyDir (const wxString &sourceDir, const wxString &destDir, bool ifNotExists=true, const wxString &wildcard=wxT("*"), int dirFlags=wxDIR_FILES) |
Copy files in sourceDir to destDir. | |
static bool | CopyFile (const wxString &file1, const wxString &file2, int flags=AX_COPYFILE_OVERWRITE|AX_COPYFILE_IGNORE_PERMISSIONS) |
Replacement for wxWidgets function that fails if can't set permissions. | |
static bool | BufferedCopy (wxInputStream &inStream, wxOutputStream &outStream, size_t size) |
Copy a fixed size of data from an input stream to an output stream, using a buffer to speed it up. | |
static bool | BufferedCopy (wxInputStream &inStream, wxOutputStream &outStream) |
Copy data from an input stream to an output stream, using a buffer to speed it up. | |
static bool | CopyFileToStream (wxOutputStream &stream, const wxString &filename) |
Copy file to stream. | |
static bool | CopyStreamToFile (wxInputStream &stream, const wxString &filename, size_t size) |
Copy stream to new file. | |
static wxString | GetExtension (const wxString &filename) |
Gets the extension. | |
static bool | HasExtension (const wxString &filename, const wxString &ext) |
Does the filename have this extension? | |
static bool | StripExtension (wxString &path, const wxString &validExtensions=wxEmptyString) |
Intelligent strip extension: don't strip before a separator, and don't strip if the 'extension' is different from the passed extension that we expect - can be comma-separated list. | |
static void | EnsureExtension (wxString &path, const wxString &requiredExt) |
Ensure extension is present. | |
static bool | SplitPath (const wxString &fullpath, wxString *path, wxString *name, wxString *ext, wxPathFormat format=wxPATH_NATIVE) |
Improved wxFileName::SplitPath. | |
static bool | RemoveTrailingSeparator (wxString &filename) |
Remove trailing separator. | |
static bool | ExecuteFile (const wxString &command, const wxString &specificErrorMessage=wxEmptyString) |
Execute the command. | |
static wxString | MakeValidFilename (const wxString &filename, bool allowSpaces=true) |
Convert to a valid filename (assumes no path separators in filename). |
AxFileUtilities::AxFileUtilities | ( | ) | [inline] |
Constructor.
wxString AxFileUtilities::AppendPaths | ( | const wxString & | p1, | |
const wxString & | p2, | |||
const wxString & | sep = wxFILE_SEP_PATH | |||
) | [static] |
Append paths without duplicating the separator.
bool AxFileUtilities::BufferedCopy | ( | wxInputStream & | inStream, | |
wxOutputStream & | outStream | |||
) | [static] |
Copy data from an input stream to an output stream, using a buffer to speed it up.
This version doesn't need a size.
bool AxFileUtilities::BufferedCopy | ( | wxInputStream & | inStream, | |
wxOutputStream & | outStream, | |||
size_t | size | |||
) | [static] |
Copy a fixed size of data from an input stream to an output stream, using a buffer to speed it up.
bool AxFileUtilities::Chmod | ( | const wxString & | path, | |
int | mode, | |||
bool | addMode = false | |||
) | [static] |
Change the Unix file mode.
bool AxFileUtilities::CopyDir | ( | const wxString & | sourceDir, | |
const wxString & | destDir, | |||
bool | ifNotExists = true , |
|||
const wxString & | wildcard = wxT("*") , |
|||
int | dirFlags = wxDIR_FILES | |||
) | [static] |
Copy files in sourceDir to destDir.
bool AxFileUtilities::CopyFile | ( | const wxString & | file1, | |
const wxString & | file2, | |||
int | flags = AX_COPYFILE_OVERWRITE | AX_COPYFILE_IGNORE_PERMISSIONS | |||
) | [static] |
Replacement for wxWidgets function that fails if can't set permissions.
bool AxFileUtilities::CopyFileToStream | ( | wxOutputStream & | stream, | |
const wxString & | filename | |||
) | [static] |
Copy file to stream.
bool AxFileUtilities::CopyStreamToFile | ( | wxInputStream & | stream, | |
const wxString & | filename, | |||
size_t | size | |||
) | [static] |
Copy stream to new file.
void AxFileUtilities::EnsureExtension | ( | wxString & | path, | |
const wxString & | requiredExt | |||
) | [static] |
Ensure extension is present.
bool AxFileUtilities::ExecuteFile | ( | const wxString & | command, | |
const wxString & | specificErrorMessage = wxEmptyString | |||
) | [static] |
Execute the command.
bool AxFileUtilities::FindAndChmod | ( | const wxString & | searchPath, | |
const wxString & | filename, | |||
int | mode, | |||
bool | addMode = false | |||
) | [static] |
Find the given file under the a path and change its mode.
wxString AxFileUtilities::GetDocumentDirectory | ( | ) | [static] |
Get a suitable directory for putting documents by default.
wxString AxFileUtilities::GetExtension | ( | const wxString & | filename | ) | [static] |
Gets the extension.
int AxFileUtilities::GetFileMode | ( | const wxString & | path | ) | [static] |
Get the Unix file mode. If path is empty, get the default mode for a new file.
wxString AxFileUtilities::GetUserAppDataDirectory | ( | const wxString & | appName | ) | [static] |
Get the application data directory for the current user.
bool AxFileUtilities::HasExtension | ( | const wxString & | filename, | |
const wxString & | ext | |||
) | [static] |
Does the filename have this extension?
wxString AxFileUtilities::MakeValidFilename | ( | const wxString & | filename, | |
bool | allowSpaces = true | |||
) | [static] |
Convert to a valid filename (assumes no path separators in filename).
bool AxFileUtilities::MkDirRecursively | ( | const wxString & | path | ) | [static] |
Make sure the folder exists, otherwise create recursively.
bool AxFileUtilities::RemoveDirRecursively | ( | const wxString & | path | ) | [static] |
Remove dir recursively.
bool AxFileUtilities::RemoveTrailingSeparator | ( | wxString & | filename | ) | [static] |
Remove trailing separator.
bool AxFileUtilities::SplitPath | ( | const wxString & | fullpath, | |
wxString * | path, | |||
wxString * | name, | |||
wxString * | ext, | |||
wxPathFormat | format = wxPATH_NATIVE | |||
) | [static] |
Improved wxFileName::SplitPath.
bool AxFileUtilities::StripExtension | ( | wxString & | path, | |
const wxString & | validExtensions = wxEmptyString | |||
) | [static] |
Intelligent strip extension: don't strip before a separator, and don't strip if the 'extension' is different from the passed extension that we expect - can be comma-separated list.