Vuo
0.9.1
|
Functions for dealing with files.
Classes | |
class | File |
A file in either a directory or an archive. More... | |
Static Public Member Functions | |
static void | splitPath (string path, string &dir, string &file, string &extension) |
Splits path into its directory, file name, and file extension. | |
static string | makeTmpFile (string file, string extension, string directory="/tmp") |
Creates a new temporary file, avoiding any name conflicts with existing files. | |
static string | makeTmpDir (string dir) |
Creates a new temporary directory, avoiding any name conflicts with existing files. | |
static string | getTmpDir (void) |
Returns the path of the default temporary directory. | |
static string | getVuoFrameworkPath (void) |
Returns the path of Vuo.framework, or an empty string if Vuo.framework cannot be located. | |
static size_t | getFirstInsertionIndex (string s) |
Returns the first index at which content can be inserted into a string that was read from a file. | |
static string | readStdinToString (void) |
Reads from standard input into a string until the end-of-file is reached. | |
static string | readFileToString (string path) |
Reads the whole contents of the file into a string. | |
static void | writeRawDataToFile (const char *data, size_t numBytes, string file) |
Writes the array of bytes to the file. | |
static void | writeStringToFile (string s, string file) |
Writes the string to the file. | |
static bool | fileExists (string path) |
Returns true if the file exists. | |
static set< File * > | findAllFilesInDirectory (string dirPath, set< string > archiveExtensions=set< string >(), bool shouldSearchRecursively=false) |
Searches a directory for files. | |
static set< File * > | findFilesInDirectory (string dirPath, set< string > extensions, set< string > archiveExtensions=set< string >()) |
Searches a directory for files with a given extension. | |
static set< File * > | findAllFilesInArchive (string archivePath) |
Recursively searches an archive for files. | |
static set< File * > | findFilesInArchive (string archivePath, string dirPath, set< string > extensions) |
Recursively searches an archive for files within a given directory and with a given extension. | |
static string | getArchiveFileContentsAsString (string archivePath, string filePath) |
Returns the contents of a file within an archive. | |
|
static |
Returns true if the file exists.
|
static |
Recursively searches an archive for files.
archivePath | The archive to search in. |
|
static |
Searches a directory for files.
dirPath | The directory to search in. Only the top level is searched. |
archiveExtensions | The file extensions for archives to search in. Any archive with one of these extensions found in the top level of the directory will be searched recursively. |
shouldSearchRecursively | If true, the directory will be searched searched recursively. |
|
static |
Recursively searches an archive for files within a given directory and with a given extension.
archivePath | The archive to search in. |
dirPath | The directory to search in within the archive. The path should be relative to the archive's root. The path should omit the trailing file separator (e.g. "examples" not "examples/"). |
extensions | The file extensions to search for, without the '.' character (e.g. "bc" not ".bc"). |
|
static |
Searches a directory for files with a given extension.
dirPath | The directory to search in. Only the top level is searched. |
archiveExtensions | The file extensions for archives to search in. Any archive with one of these extensions found in the top level of the directory will be searched recursively. |
extensions | The file extensions to search for, without the '.' character (e.g. "bc" not ".bc"). |
|
static |
Returns the contents of a file within an archive.
If the file doesn't exist, returns an empty string.
archivePath | The archive containing the file. |
filePath | The file. The path should be relative to the archive's root. |
|
static |
Returns the first index at which content can be inserted into a string that was read from a file.
This comes after the Unicode BOM, if present.
|
static |
Returns the path of the default temporary directory.
|
static |
Returns the path of Vuo.framework, or an empty string if Vuo.framework cannot be located.
|
static |
Creates a new temporary directory, avoiding any name conflicts with existing files.
Returns the path of the directory.
|
static |
Creates a new temporary file, avoiding any name conflicts with existing files.
Creates the file in the specified directory
if one is provided, or in "/tmp" otherwise.
Returns the path of the file.
|
static |
Reads the whole contents of the file into a string.
|
static |
Reads from standard input into a string until the end-of-file is reached.
|
static |
Splits path
into its directory, file name, and file extension.
[in] | path | The path to split. |
[out] | dir | The directory in path , if any. Ends with a file separator (e.g. '/') if there was one in path . |
[out] | file | The file name in path , if any. |
[out] | extension | The file extension in path , if any. Does not include the '.' character. |
|
static |
Writes the array of bytes to the file.
If the file already exists, it gets overwritten.
|
static |
Writes the string to the file.
If the file already exists, it gets overwritten.