#include <fileutils/fileutils.h>
Static Public Member Functions | |
static bool | FilesEqual (const wxString &filename1, const wxString &filename2) |
Are the two files identical in content? | |
static bool | RenameOrCopyFile (const wxString &filename1, const wxString &filename2) |
Rename first file to second file, copying and deleting original file if the rename didn't work. | |
static wxString | GetTempDirectory () |
Get temporary directory. | |
static wxString | GetDocumentDirectory () |
Get document directory. | |
static wxString | GetUserAppDataDirectory (const wxString &appName) |
Get application data directory. | |
static wxString | GetDownloadDirectory () |
Get suitable download directory. | |
static bool | DirExists (const wxString &str) |
Does an extra test in case there's a symbolic link that looks like a 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 | RemoveTrailingSeparator (wxString &filename) |
Remove trailing 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 | IsReadOnly (const wxString &filename) |
Is read-only? | |
static bool | IsAbsolutePath (const wxString &path) |
Is this an absolute path? | |
static wxString | MakeRelative (const wxString &path, const wxString &appPath) |
Makes an absolute path relative if is under appPath. | |
static wxString | MakeAbsolute (const wxString &path, const wxString &appPath) |
Makes a relative path absolute. | |
static bool | ExploreFolder (const wxString &folder) |
Explores the given folder, under Windows only. | |
static wxString | AppendPaths (const wxString &p1, const wxString &p2, const wxString &sep=wxFILE_SEP_PATH) |
Append paths without duplicating separator;. | |
static bool | DriveExists (const wxString &drive) |
Does the drive exist? | |
static bool | GetAvailableDrives (wxArrayString &paths, wxArrayString &names, bool removableOnly=false) |
Get available drives, optionally only the removable ones. | |
static bool | GetVolumeFromFilename (const wxString &filename, wxString &volume) |
Try to get a volume (drive) from the filename, return true if successful. | |
static bool | SplitVolume (const wxString &path, wxString &filename, wxString &volume) |
Split volume and filename from path. Returns false if we can't (e.g. wasn't a removeable volume). | |
static bool | GetFilenameSubstitutingVolume (const wxString &filename, wxString &newFilename, const wxString &newVolume, const wxString &oldVolume, bool isFilename=true) |
Find the file substituting this volume. Tests existence first. | |
static void | FileHistoryLoadWithVolumeSubstitution (wxFileHistory &fileHistory, wxConfigBase &config, const wxString &newVolume, const wxString &oldVolume) |
Load file history with volume substitution if file not found. | |
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 | 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 wxArrayString | SplitCommand (const wxString &command) |
Interpret command line as an array. | |
static bool | SplitPath (const wxString &fullpath, wxString *path, wxString *name, wxString *ext, wxPathFormat format=wxPATH_NATIVE) |
Improved wxFileName::SplitPath. | |
static wxString | FindInPath (const wxString &cmd) |
Find file/command on PATH, or empty string if not found. | |
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=FILEUTILS_COPYFILE_OVERWRITE|FILEUTILS_COPYFILE_IGNORE_PERMISSIONS) |
static bool | SafelyCopyFile (const wxString &tempFilename, const wxString &targetFilename, const wxString &backupFilename=wxEmptyString, bool leaveBackup=true, wxWindow *parent=NULL) |
static bool | SafelyCreateFileOutputStream (wxFileOutputStream **stream, const wxString &filename, wxWindow *parent=NULL, const wxString &msg=wxEmptyString, const wxString &title=wxEmptyString) |
static bool | SafelyCreateFile (wxFFile **file, const wxString &filename, wxWindow *parent=NULL, const wxString &msg=wxEmptyString, const wxString &title=wxEmptyString) |
static bool | SafelyCreateFile (wxFile **file, const wxString &filename, wxWindow *parent=NULL, const wxString &msg=wxEmptyString, const wxString &title=wxEmptyString) |
static wxString | FindHtmlEncoding (const wxString &filename) |
Find the encoding of an HTML file. | |
static wxString | MakeValidFilename (const wxString &filename, bool allowSpaces=false) |
Convert to a valid filename (assumes no path separators in filename). |
wxString FileUtilities::AppendPaths | ( | const wxString & | p1, | |
const wxString & | p2, | |||
const wxString & | sep = wxFILE_SEP_PATH | |||
) | [static] |
Append paths without duplicating separator;.
bool FileUtilities::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 FileUtilities::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.
File/stream utility functions.
bool FileUtilities::Chmod | ( | const wxString & | path, | |
int | mode, | |||
bool | addMode = false | |||
) | [static] |
Change the Unix file mode.
bool FileUtilities::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 FileUtilities::CopyFile | ( | const wxString & | file1, | |
const wxString & | file2, | |||
int | flags = FILEUTILS_COPYFILE_OVERWRITE | FILEUTILS_COPYFILE_IGNORE_PERMISSIONS | |||
) | [static] |
bool FileUtilities::CopyFileToStream | ( | wxOutputStream & | stream, | |
const wxString & | filename | |||
) | [static] |
Copy file to stream.
bool FileUtilities::CopyStreamToFile | ( | wxInputStream & | stream, | |
const wxString & | filename, | |||
size_t | size | |||
) | [static] |
Copy stream to new file.
bool FileUtilities::DirExists | ( | const wxString & | str | ) | [static] |
Does an extra test in case there's a symbolic link that looks like a file.
bool FileUtilities::DriveExists | ( | const wxString & | drive | ) | [static] |
Does the drive exist?
void FileUtilities::EnsureExtension | ( | wxString & | path, | |
const wxString & | requiredExt | |||
) | [static] |
Ensure extension is present.
bool FileUtilities::ExploreFolder | ( | const wxString & | folder | ) | [static] |
Explores the given folder, under Windows only.
void FileUtilities::FileHistoryLoadWithVolumeSubstitution | ( | wxFileHistory & | fileHistory, | |
wxConfigBase & | config, | |||
const wxString & | newVolume, | |||
const wxString & | oldVolume | |||
) | [static] |
Load file history with volume substitution if file not found.
bool FileUtilities::FilesEqual | ( | const wxString & | filename1, | |
const wxString & | filename2 | |||
) | [static] |
Are the two files identical in content?
bool FileUtilities::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 FileUtilities::FindHtmlEncoding | ( | const wxString & | filename | ) | [static] |
Find the encoding of an HTML file.
wxString FileUtilities::FindInPath | ( | const wxString & | cmd | ) | [static] |
Find file/command on PATH, or empty string if not found.
bool FileUtilities::GetAvailableDrives | ( | wxArrayString & | paths, | |
wxArrayString & | names, | |||
bool | removableOnly = false | |||
) | [static] |
Get available drives, optionally only the removable ones.
wxString FileUtilities::GetDocumentDirectory | ( | ) | [static] |
Get document directory.
wxString FileUtilities::GetDownloadDirectory | ( | ) | [static] |
Get suitable download directory.
wxString FileUtilities::GetExtension | ( | const wxString & | filename | ) | [static] |
Gets the extension.
int FileUtilities::GetFileMode | ( | const wxString & | path | ) | [static] |
Get the Unix file mode. If path is empty, get the default mode for a new file.
bool FileUtilities::GetFilenameSubstitutingVolume | ( | const wxString & | filename, | |
wxString & | newFilename, | |||
const wxString & | newVolume, | |||
const wxString & | oldVolume, | |||
bool | isFilename = true | |||
) | [static] |
Find the file substituting this volume. Tests existence first.
wxString FileUtilities::GetTempDirectory | ( | ) | [static] |
Get temporary directory.
wxString FileUtilities::GetUserAppDataDirectory | ( | const wxString & | appName | ) | [static] |
Get application data directory.
bool FileUtilities::GetVolumeFromFilename | ( | const wxString & | filename, | |
wxString & | volume | |||
) | [static] |
Try to get a volume (drive) from the filename, return true if successful.
bool FileUtilities::HasExtension | ( | const wxString & | filename, | |
const wxString & | ext | |||
) | [static] |
Does the filename have this extension?
bool FileUtilities::IsAbsolutePath | ( | const wxString & | path | ) | [static] |
Is this an absolute path?
bool FileUtilities::IsReadOnly | ( | const wxString & | filename | ) | [static] |
Is read-only?
wxString FileUtilities::MakeAbsolute | ( | const wxString & | path, | |
const wxString & | appPath | |||
) | [static] |
Makes a relative path absolute.
wxString FileUtilities::MakeRelative | ( | const wxString & | path, | |
const wxString & | appPath | |||
) | [static] |
Makes an absolute path relative if is under appPath.
wxString FileUtilities::MakeValidFilename | ( | const wxString & | filename, | |
bool | allowSpaces = false | |||
) | [static] |
Convert to a valid filename (assumes no path separators in filename).
bool FileUtilities::MkDirRecursively | ( | const wxString & | path | ) | [static] |
Make sure the folder exists, otherwise create recursively.
bool FileUtilities::RemoveDirRecursively | ( | const wxString & | path | ) | [static] |
Remove dir recursively.
bool FileUtilities::RemoveTrailingSeparator | ( | wxString & | filename | ) | [static] |
Remove trailing separator.
bool FileUtilities::RenameOrCopyFile | ( | const wxString & | filename1, | |
const wxString & | filename2 | |||
) | [static] |
Rename first file to second file, copying and deleting original file if the rename didn't work.
bool FileUtilities::SafelyCopyFile | ( | const wxString & | tempFilename, | |
const wxString & | targetFilename, | |||
const wxString & | backupFilename = wxEmptyString , |
|||
bool | leaveBackup = true , |
|||
wxWindow * | parent = NULL | |||
) | [static] |
bool FileUtilities::SafelyCreateFile | ( | wxFile ** | file, | |
const wxString & | filename, | |||
wxWindow * | parent = NULL , |
|||
const wxString & | msg = wxEmptyString , |
|||
const wxString & | title = wxEmptyString | |||
) | [static] |
bool FileUtilities::SafelyCreateFile | ( | wxFFile ** | file, | |
const wxString & | filename, | |||
wxWindow * | parent = NULL , |
|||
const wxString & | msg = wxEmptyString , |
|||
const wxString & | title = wxEmptyString | |||
) | [static] |
bool FileUtilities::SafelyCreateFileOutputStream | ( | wxFileOutputStream ** | stream, | |
const wxString & | filename, | |||
wxWindow * | parent = NULL , |
|||
const wxString & | msg = wxEmptyString , |
|||
const wxString & | title = wxEmptyString | |||
) | [static] |
wxArrayString FileUtilities::SplitCommand | ( | const wxString & | command | ) | [static] |
Interpret command line as an array.
bool FileUtilities::SplitPath | ( | const wxString & | fullpath, | |
wxString * | path, | |||
wxString * | name, | |||
wxString * | ext, | |||
wxPathFormat | format = wxPATH_NATIVE | |||
) | [static] |
Improved wxFileName::SplitPath.
bool FileUtilities::SplitVolume | ( | const wxString & | path, | |
wxString & | filename, | |||
wxString & | volume | |||
) | [static] |
Split volume and filename from path. Returns false if we can't (e.g. wasn't a removeable volume).
bool FileUtilities::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.