Vuo  2.3.2
Classes | Static Public Member Functions | List of all members
VuoFileUtilities Class Reference

Description

Functions for dealing with files.

Definition at line 26 of file VuoFileUtilities.hh.

Classes

class  Archive
 An archive of files. More...
 
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. More...
 
static void canonicalizePath (string &path)
 Transforms path to a standard format. More...
 
static bool arePathsEqual (string path1, string path2)
 Returns true if the paths refer to the same location. More...
 
static string getAbsolutePath (const string &path)
 Returns the absolute path of path (which may be relative or absolute). More...
 
static string makeTmpFile (string file, string extension, string directory="")
 Creates a new temporary file with mode 0600, avoiding any name conflicts with existing files. More...
 
static string makeTmpDir (string prefix)
 Creates a new temporary directory with mode 0700, whose final path element begins with prefix and has a unique extension (avoiding name conflicts with existing files). More...
 
static string makeTmpDirOnSameVolumeAsPath (string path)
 Creates a new temporary directory, avoiding any name conflicts with existing files. More...
 
static string getTmpDir (void)
 For non-sandboxed processes, returns the user's private temporary directory if avaialble (e.g., /var/folders/f3/v1j4zqhs5jz5757t0rmh7jj80000gn/T), otherwise returns the system temporary directory (/tmp). More...
 
static void makeDir (string path)
 Creates a new directory (and parent directories if needed), if it doesn't already exist. More...
 
static string getVuoFrameworkPath (void)
 Returns the absolute path of Vuo.framework (without a trailing slash), or an empty string if Vuo.framework cannot be located. More...
 
static string getVuoRunnerFrameworkPath (void)
 Returns the absolute path of VuoRunner.framework (without a trailing slash), or an empty string if VuoRunner.framework cannot be located. More...
 
static string getCompositionLocalModulesPath (const string &compositionPath)
 Returns the path of the composition-local Modules folder for a composition located at compositionPath. More...
 
static string getUserModulesPath (void)
 Returns the filesystem path to the user-specific Vuo Modules folder (without a trailing slash). More...
 
static string getSystemModulesPath (void)
 Returns the filesystem path to the system-wide Vuo Modules folder (without a trailing slash). More...
 
static string getCachePath (void)
 Returns the filesystem path to the folder that Vuo uses to cache data (without a trailing slash). More...
 
static bool isInstalledAsModule (const string &path)
 Returns true if path (a source file or compiled module) is located in a Modules folder. More...
 
static void preserveOriginalFileName (string &fileContents, string originalFileName)
 Saves originalFileName into fileContents so that, when fileContents is written to some other file path, originalFileName will still be the name that shows up in compile errors/warnings and in the FILE macro. More...
 
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. More...
 
static string readStdinToString (void)
 Reads from standard input into a string until the end-of-file is reached. More...
 
static string readFileToString (string path)
 Reads the whole contents of the file into a string. More...
 
static void writeRawDataToFile (const char *data, size_t numBytes, string file)
 Writes the array of bytes to the file. More...
 
static void writeStringToFile (string s, string file)
 Writes the string to the file. More...
 
static void writeStringToFileSafely (string s, string path)
 Saves to file using the standard Unix procedure (write to temporary file, then rename). More...
 
static bool fileExists (string path)
 Returns true if the file exists. More...
 
static bool dirExists (string path)
 Returns true if path exists and is a directory. More...
 
static bool isSymlink (string path)
 Returns true if path exists and is a symlink. More...
 
static bool fileIsReadable (string path)
 Returns true if the file or directory is readable. More...
 
static bool fileContainsReadableData (string path)
 Returns true if the file exists, can be opened, and has a size of more than 0 bytes. More...
 
static void createFile (string path)
 Creates the file if it does not exist already; otherwise, has no effect on the file. More...
 
static void deleteFile (string path)
 Deletes the file or directory if it exists and, if a directory, is empty; otherwise, has no effect. More...
 
static void deleteDir (string path)
 Deletes the directory and its contents if the directory exists; otherwise, has no effect. More...
 
static void moveFile (string fromPath, string toPath)
 Moves the file from fromPath to toPath. More...
 
static void moveFileToTrash (string filePath)
 Moves the specified file to the user's trash folder. More...
 
static void copyFile (string fromPath, string toPath, bool preserveMetadata=false)
 Copies the file from fromPath to toPath, preserving the file's mode. More...
 
static void copyDirectory (string fromPath, string toPath)
 Recursively copies the provided file or directory from fromPath to toPath. More...
 
static string calculateFileSHA256 (const string &path)
 Returns the SHA-256 hash of the file at path as a string of hex digits. More...
 
static unsigned long getFileLastModifiedInSeconds (string path)
 Returns the time that the file was last modified, in seconds from a reference date. More...
 
static unsigned long getSecondsSinceFileLastAccessed (string path)
 Returns the time since the file was last accessed, in seconds. More...
 
static set< File * > findAllFilesInDirectory (string dirPath, set< string > archiveExtensions=set< string >(), bool shouldSearchRecursively=false)
 Searches a directory for files. More...
 
static set< File * > findFilesInDirectory (string dirPath, set< string > extensions, set< string > archiveExtensions=set< string >())
 Searches a directory for files with a given extension. More...
 
static set< File * > findAllFilesInArchive (string archivePath)
 Recursively searches an archive for files. More...
 
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. More...
 
static string getArchiveFileContentsAsString (string archivePath, string filePath)
 Returns the contents of a file within an archive. More...
 
static size_t getAvailableSpaceOnVolumeContainingPath (string path)
 Returns the available space, in bytes, on the volume containing the specified path. More...
 
static void focusProcess (pid_t pid, bool force=false)
 Attempts to focus the specified pid (i.e., bring all its windows to the front and make one of them key). More...
 
static void executeProcess (vector< string > processAndArgs, vector< string > environment={})
 Launches another process and waits for it to finish. More...
 
static bool isCompositionExtension (string extension)
 Returns true if the given extension (without leading dot) is a Vuo composition file. More...
 
static set< string > getCSourceExtensions (void)
 Returns C/C++/Objective-C/Objective-C++ source file extensions (without a leading dot). More...
 
static bool isCSourceExtension (string extension)
 Returns true if the given extension (without leading dot) is a C/C++/Objective-C/Objective-C++ source file. More...
 
static bool isIsfSourceExtension (string extension)
 Returns true if the given extension (without leading dot) is an ISF source file. More...
 
static string buildModuleCacheDescription (const string &moduleCachePath, bool generated)
 Returns a human-readable description of the module cache. More...
 
static string buildModuleCacheIndexPath (const string &moduleCachePath, bool builtIn, bool generated)
 Returns the path of the index file within the module cache. More...
 
static string buildModuleCacheDylibPath (const string &moduleCachePath, bool builtIn, bool generated)
 Returns the path of a dylib file within the module cache. More...
 
static string findLatestRevisionOfModuleCacheDylib (const string &moduleCachePath, bool builtIn, bool generated, unsigned long &lastModified)
 Returns the most recently created dylib file within the module cache, or an empty string if none exists. More...
 
static void deleteOtherRevisionsOfModuleCacheDylib (const string &dylibPath)
 Deletes any files in the same directory as dylibPath that differ only in their revision suffix. More...
 
static bool areDifferentRevisionsOfSameModuleCacheDylib (const string &dylibPath1, const string &dylibPath2)
 Returns true if the two paths differ only in their revision suffix. More...
 

Member Function Documentation

◆ areDifferentRevisionsOfSameModuleCacheDylib()

bool VuoFileUtilities::areDifferentRevisionsOfSameModuleCacheDylib ( const string &  dylibPath1,
const string &  dylibPath2 
)
static

Returns true if the two paths differ only in their revision suffix.

Definition at line 1631 of file VuoFileUtilities.cc.

◆ arePathsEqual()

bool VuoFileUtilities::arePathsEqual ( string  path1,
string  path2 
)
static

Returns true if the paths refer to the same location.

This handles different formats for the same path (by comparing the canonicalized paths). It does not follow symlinks.

Definition at line 93 of file VuoFileUtilities.cc.

◆ buildModuleCacheDescription()

string VuoFileUtilities::buildModuleCacheDescription ( const string &  moduleCachePath,
bool  generated 
)
static

Returns a human-readable description of the module cache.

Definition at line 1525 of file VuoFileUtilities.cc.

◆ buildModuleCacheDylibPath()

string VuoFileUtilities::buildModuleCacheDylibPath ( const string &  moduleCachePath,
bool  builtIn,
bool  generated 
)
static

Returns the path of a dylib file within the module cache.

  • For the built-in module caches, the returned path is always the same.
  • For other module caches, this function returns an unused path at which a new revision of the dylib can be saved.

Definition at line 1546 of file VuoFileUtilities.cc.

◆ buildModuleCacheIndexPath()

string VuoFileUtilities::buildModuleCacheIndexPath ( const string &  moduleCachePath,
bool  builtIn,
bool  generated 
)
static

Returns the path of the index file within the module cache.

Definition at line 1533 of file VuoFileUtilities.cc.

◆ calculateFileSHA256()

string VuoFileUtilities::calculateFileSHA256 ( const string &  path)
static

Returns the SHA-256 hash of the file at path as a string of hex digits.

Exceptions
VuoException

Definition at line 811 of file VuoFileUtilities.cc.

◆ canonicalizePath()

void VuoFileUtilities::canonicalizePath ( string &  path)
static

Transforms path to a standard format.

The returned path is absolute if path is absolute, relative if path is relative.

Definition at line 74 of file VuoFileUtilities.cc.

◆ copyDirectory()

void VuoFileUtilities::copyDirectory ( string  fromPath,
string  toPath 
)
static

Recursively copies the provided file or directory from fromPath to toPath.

Preserves symlinks (rather than copying their target files).

Exceptions
VuoExceptionThe file couldn't be copied.
Changed in Vuo 2.0.0:
Each copied file now preserves the original file's mode.

Definition at line 775 of file VuoFileUtilities.cc.

◆ copyFile()

void VuoFileUtilities::copyFile ( string  fromPath,
string  toPath,
bool  preserveMetadata = false 
)
static

Copies the file from fromPath to toPath, preserving the file's mode.

If preserveMetadata is true and toPath already exists, the file's inode and stat info is preserved, thus so are any locks on the file.

Exceptions
VuoExceptionThe file couldn't be copied.
Changed in Vuo 2.0.0:
The copied file now preserves the original file's mode.

Definition at line 740 of file VuoFileUtilities.cc.

◆ createFile()

void VuoFileUtilities::createFile ( string  path)
static

Creates the file if it does not exist already; otherwise, has no effect on the file.

Definition at line 656 of file VuoFileUtilities.cc.

◆ deleteDir()

void VuoFileUtilities::deleteDir ( string  path)
static

Deletes the directory and its contents if the directory exists; otherwise, has no effect.

Definition at line 675 of file VuoFileUtilities.cc.

◆ deleteFile()

void VuoFileUtilities::deleteFile ( string  path)
static

Deletes the file or directory if it exists and, if a directory, is empty; otherwise, has no effect.

Definition at line 665 of file VuoFileUtilities.cc.

◆ deleteOtherRevisionsOfModuleCacheDylib()

void VuoFileUtilities::deleteOtherRevisionsOfModuleCacheDylib ( const string &  dylibPath)
static

Deletes any files in the same directory as dylibPath that differ only in their revision suffix.

Definition at line 1613 of file VuoFileUtilities.cc.

◆ dirExists()

bool VuoFileUtilities::dirExists ( string  path)
static

Returns true if path exists and is a directory.

If path is a symlink or macOS Alias, it is dereferenced.

Definition at line 587 of file VuoFileUtilities.cc.

◆ executeProcess()

void VuoFileUtilities::executeProcess ( vector< string >  processAndArgs,
vector< string >  environment = {} 
)
static

Launches another process and waits for it to finish.

If the exit status is nonzero, throws an exception containing stdout and stderr.

The optional environment argument should consist of strings of the form key=value.

Exceptions
VuoException

Definition at line 1383 of file VuoFileUtilities.cc.

◆ fileContainsReadableData()

bool VuoFileUtilities::fileContainsReadableData ( string  path)
static

Returns true if the file exists, can be opened, and has a size of more than 0 bytes.

If path is a symlink or macOS Alias, it is dereferenced.

Definition at line 627 of file VuoFileUtilities.cc.

◆ fileExists()

bool VuoFileUtilities::fileExists ( string  path)
static

Returns true if the file exists.

If path is a symlink or macOS Alias, it is dereferenced.

Definition at line 573 of file VuoFileUtilities.cc.

◆ fileIsReadable()

bool VuoFileUtilities::fileIsReadable ( string  path)
static

Returns true if the file or directory is readable.

If path is a symlink or macOS Alias, it is dereferenced.

Definition at line 613 of file VuoFileUtilities.cc.

◆ findAllFilesInArchive()

set< VuoFileUtilities::File * > VuoFileUtilities::findAllFilesInArchive ( string  archivePath)
static

Recursively searches an archive for files.

Parameters
archivePathThe archive to search in.
Returns
All files found.

Definition at line 984 of file VuoFileUtilities.cc.

◆ findAllFilesInDirectory()

set< VuoFileUtilities::File * > VuoFileUtilities::findAllFilesInDirectory ( string  dirPath,
set< string >  archiveExtensions = set<string>(),
bool  shouldSearchRecursively = false 
)
static

Searches a directory for files.

If dirPath is a symlink or macOS Alias, it is dereferenced.

Parameters
dirPathThe directory to search in.
archiveExtensionsThe 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.
shouldSearchRecursivelyIf true, the directory will be searched searched recursively. If false, only the top level is searched.
Returns
All files found.
Exceptions
VuoExceptionThe directory couldn't be read.

Definition at line 879 of file VuoFileUtilities.cc.

◆ findFilesInArchive()

set< VuoFileUtilities::File * > VuoFileUtilities::findFilesInArchive ( string  archivePath,
string  dirPath,
set< string >  extensions 
)
static

Recursively searches an archive for files within a given directory and with a given extension.

Parameters
archivePathThe archive to search in.
dirPathThe 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/").
extensionsThe file extensions to search for, without the '.' character (e.g. "bc" not ".bc").
Returns
All files found.

Definition at line 1025 of file VuoFileUtilities.cc.

◆ findFilesInDirectory()

set< VuoFileUtilities::File * > VuoFileUtilities::findFilesInDirectory ( string  dirPath,
set< string >  extensions,
set< string >  archiveExtensions = set<string>() 
)
static

Searches a directory for files with a given extension.

Parameters
dirPathThe directory to search in. Only the top level is searched.
archiveExtensionsThe 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.
extensionsThe file extensions to search for, without the '.' character (e.g. "bc" not ".bc").
Returns
All files found.

Definition at line 957 of file VuoFileUtilities.cc.

◆ findLatestRevisionOfModuleCacheDylib()

string VuoFileUtilities::findLatestRevisionOfModuleCacheDylib ( const string &  moduleCachePath,
bool  builtIn,
bool  generated,
unsigned long &  lastModified 
)
static

Returns the most recently created dylib file within the module cache, or an empty string if none exists.

Definition at line 1565 of file VuoFileUtilities.cc.

◆ focusProcess()

void VuoFileUtilities::focusProcess ( pid_t  pid,
bool  force = false 
)
static

Attempts to focus the specified pid (i.e., bring all its windows to the front and make one of them key).

This function may only be called on the main thread.

Definition at line 1370 of file VuoFileUtilities.cc.

◆ getAbsolutePath()

string VuoFileUtilities::getAbsolutePath ( const string &  path)
static

Returns the absolute path of path (which may be relative or absolute).

Definition at line 103 of file VuoFileUtilities.cc.

◆ getArchiveFileContentsAsString()

string VuoFileUtilities::getArchiveFileContentsAsString ( string  archivePath,
string  filePath 
)
static

Returns the contents of a file within an archive.

If the file doesn't exist, returns an empty string.

Parameters
archivePathThe archive containing the file.
filePathThe file. The path should be relative to the archive's root.
Returns
The file's contents.

Definition at line 1061 of file VuoFileUtilities.cc.

◆ getAvailableSpaceOnVolumeContainingPath()

size_t VuoFileUtilities::getAvailableSpaceOnVolumeContainingPath ( string  path)
static

Returns the available space, in bytes, on the volume containing the specified path.

path should be an absolute POSIX path. Its last few path components needn't exist.

Exceptions
VuoException

Definition at line 1083 of file VuoFileUtilities.cc.

◆ getCachePath()

string VuoFileUtilities::getCachePath ( void  )
static

Returns the filesystem path to the folder that Vuo uses to cache data (without a trailing slash).

Definition at line 420 of file VuoFileUtilities.cc.

◆ getCompositionLocalModulesPath()

string VuoFileUtilities::getCompositionLocalModulesPath ( const string &  compositionPath)
static

Returns the path of the composition-local Modules folder for a composition located at compositionPath.

(The composition file need not actually exist.)

If the composition is installed as a subcomposition (it's located in a folder called Modules), returns that folder. Otherwise, returns a Modules folder located in the same folder as the composition.

Definition at line 383 of file VuoFileUtilities.cc.

◆ getCSourceExtensions()

set< string > VuoFileUtilities::getCSourceExtensions ( void  )
static

Returns C/C++/Objective-C/Objective-C++ source file extensions (without a leading dot).

Definition at line 1486 of file VuoFileUtilities.cc.

◆ getFileLastModifiedInSeconds()

unsigned long VuoFileUtilities::getFileLastModifiedInSeconds ( string  path)
static

Returns the time that the file was last modified, in seconds from a reference date.

This is useful for checking which of two files was modified more recently.

Definition at line 844 of file VuoFileUtilities.cc.

◆ getFirstInsertionIndex()

size_t VuoFileUtilities::getFirstInsertionIndex ( string  s)
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.

Definition at line 458 of file VuoFileUtilities.cc.

◆ getSecondsSinceFileLastAccessed()

unsigned long VuoFileUtilities::getSecondsSinceFileLastAccessed ( string  path)
static

Returns the time since the file was last accessed, in seconds.

Definition at line 854 of file VuoFileUtilities.cc.

◆ getSystemModulesPath()

string VuoFileUtilities::getSystemModulesPath ( void  )
static

Returns the filesystem path to the system-wide Vuo Modules folder (without a trailing slash).

Definition at line 412 of file VuoFileUtilities.cc.

◆ getTmpDir()

string VuoFileUtilities::getTmpDir ( void  )
static

For non-sandboxed processes, returns the user's private temporary directory if avaialble (e.g., /var/folders/f3/v1j4zqhs5jz5757t0rmh7jj80000gn/T), otherwise returns the system temporary directory (/tmp).

For sandboxed processes, returns the sandbox container directory (e.g., /Users/me/Library/Containers/com.apple.ScreenSaver.Engine.legacyScreenSaver/Data).

The returned path does not include a trailing slash.

Definition at line 188 of file VuoFileUtilities.cc.

◆ getUserModulesPath()

string VuoFileUtilities::getUserModulesPath ( void  )
static

Returns the filesystem path to the user-specific Vuo Modules folder (without a trailing slash).

Definition at line 404 of file VuoFileUtilities.cc.

◆ getVuoFrameworkPath()

string VuoFileUtilities::getVuoFrameworkPath ( void  )
static

Returns the absolute path of Vuo.framework (without a trailing slash), or an empty string if Vuo.framework cannot be located.

For a C version accessible from nodes and libraries, see VuoGetFrameworkPath.

Definition at line 253 of file VuoFileUtilities.cc.

◆ getVuoRunnerFrameworkPath()

string VuoFileUtilities::getVuoRunnerFrameworkPath ( void  )
static

Returns the absolute path of VuoRunner.framework (without a trailing slash), or an empty string if VuoRunner.framework cannot be located.

Definition at line 313 of file VuoFileUtilities.cc.

◆ isCompositionExtension()

bool VuoFileUtilities::isCompositionExtension ( string  extension)
static

Returns true if the given extension (without leading dot) is a Vuo composition file.

Definition at line 1478 of file VuoFileUtilities.cc.

◆ isCSourceExtension()

bool VuoFileUtilities::isCSourceExtension ( string  extension)
static

Returns true if the given extension (without leading dot) is a C/C++/Objective-C/Objective-C++ source file.

Definition at line 1503 of file VuoFileUtilities.cc.

◆ isInstalledAsModule()

bool VuoFileUtilities::isInstalledAsModule ( const string &  path)
static

Returns true if path (a source file or compiled module) is located in a Modules folder.

Definition at line 428 of file VuoFileUtilities.cc.

◆ isIsfSourceExtension()

bool VuoFileUtilities::isIsfSourceExtension ( string  extension)
static

Returns true if the given extension (without leading dot) is an ISF source file.

Definition at line 1512 of file VuoFileUtilities.cc.

◆ isSymlink()

bool VuoFileUtilities::isSymlink ( string  path)
static

Returns true if path exists and is a symlink.

Definition at line 601 of file VuoFileUtilities.cc.

◆ makeDir()

void VuoFileUtilities::makeDir ( string  path)
static

Creates a new directory (and parent directories if needed), if it doesn't already exist.

Exceptions
VuoExceptionThe directory couldn't be created.
Changed in Vuo 2.0.0:
The new directory now respects the process's umask.

Definition at line 223 of file VuoFileUtilities.cc.

◆ makeTmpDir()

string VuoFileUtilities::makeTmpDir ( string  prefix)
static

Creates a new temporary directory with mode 0700, whose final path element begins with prefix and has a unique extension (avoiding name conflicts with existing files).

prefix shouldn't contain any slashes.

Returns the path of the directory (without a trailing slash).

Definition at line 153 of file VuoFileUtilities.cc.

◆ makeTmpDirOnSameVolumeAsPath()

string VuoFileUtilities::makeTmpDirOnSameVolumeAsPath ( string  path)
static

Creates a new temporary directory, avoiding any name conflicts with existing files.

The temporary directory will be on the same filesystem as the specified path, to facilitate using rename() (for example). onSameVolumeAsPath needn't already exist.

Returns the path of the directory (without a trailing slash).

Definition at line 172 of file VuoFileUtilities.cc.

◆ makeTmpFile()

string VuoFileUtilities::makeTmpFile ( string  file,
string  extension,
string  directory = "" 
)
static

Creates a new temporary file with mode 0600, avoiding any name conflicts with existing files.

Creates the file in the specified directory if one is provided, or in the user's temporary directory otherwise.

Returns the path of the file.

Definition at line 127 of file VuoFileUtilities.cc.

◆ moveFile()

void VuoFileUtilities::moveFile ( string  fromPath,
string  toPath 
)
static

Moves the file from fromPath to toPath.

Exceptions
VuoExceptionThe file couldn't be moved.

Definition at line 712 of file VuoFileUtilities.cc.

◆ moveFileToTrash()

void VuoFileUtilities::moveFileToTrash ( string  filePath)
static

Moves the specified file to the user's trash folder.

Exceptions
VuoExceptionThe file couldn't be moved.

Definition at line 724 of file VuoFileUtilities.cc.

◆ preserveOriginalFileName()

void VuoFileUtilities::preserveOriginalFileName ( string &  fileContents,
string  originalFileName 
)
static

Saves originalFileName into fileContents so that, when fileContents is written to some other file path, originalFileName will still be the name that shows up in compile errors/warnings and in the FILE macro.

This function inserts a preprocessor directive at the beginning of fileContents. Any modifications to fileContents after this function is called should keep the preprocessor directive on the first line.

Definition at line 449 of file VuoFileUtilities.cc.

◆ readFileToString()

string VuoFileUtilities::readFileToString ( string  path)
static

Reads the whole contents of the file into a string.

Exceptions
VuoExceptionThe file couldn't be read.

Definition at line 497 of file VuoFileUtilities.cc.

◆ readStdinToString()

string VuoFileUtilities::readStdinToString ( void  )
static

Reads from standard input into a string until the end-of-file is reached.

Definition at line 480 of file VuoFileUtilities.cc.

◆ splitPath()

void VuoFileUtilities::splitPath ( string  path,
string &  dir,
string &  file,
string &  extension 
)
static

Splits path into its directory, file name, and file extension.

Parameters
[in]pathThe path to split.
[out]dirThe directory in path, if any. Ends with a file separator (e.g. '/') if there was one in path.
[out]fileThe file name in path, if any.
[out]extensionThe file extension in path, if any. Does not include the '.' character.
See also
VuoUrl_getFileParts

Definition at line 38 of file VuoFileUtilities.cc.

◆ writeRawDataToFile()

void VuoFileUtilities::writeRawDataToFile ( const char *  data,
size_t  numBytes,
string  file 
)
static

Writes the array of bytes to the file.

If the file already exists, it gets overwritten.

Exceptions
VuoExceptionThe file couldn't be written.

Definition at line 521 of file VuoFileUtilities.cc.

◆ writeStringToFile()

void VuoFileUtilities::writeStringToFile ( string  s,
string  file 
)
static

Writes the string to the file.

If the file already exists, it gets overwritten.

Exceptions
VuoExceptionThe file couldn't be written.

Definition at line 544 of file VuoFileUtilities.cc.

◆ writeStringToFileSafely()

void VuoFileUtilities::writeStringToFileSafely ( string  s,
string  path 
)
static

Saves to file using the standard Unix procedure (write to temporary file, then rename).

This prevents the destination file from becoming corrupted if the write fails.

If the file already exists, it gets overwritten.

Exceptions
VuoExceptionThe file couldn't be written.

Definition at line 557 of file VuoFileUtilities.cc.


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