VCV Rack API v2
Loading...
Searching...
No Matches
system.hpp File Reference
#include <vector>
#include <common.hpp>
Include dependency graph for system.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  rack
 Root namespace for the Rack API.
 
namespace  rack::system
 Cross-platform functions for OS, file path, and filesystem routines.
 

Functions

std::string rack::system::join (const std::string &path1, const std::string &path2="")
 Joins two paths with a directory separator.
 
template<typename... Paths>
std::string rack::system::join (const std::string &path1, const std::string &path2, Paths... paths)
 Join an arbitrary number of paths, from left to right.
 
std::vector< std::string > rack::system::getEntries (const std::string &dirPath, int depth=0)
 Returns all entries (directories, files, symbolic links, etc) in a directory.
 
bool rack::system::exists (const std::string &path)
 
bool rack::system::isFile (const std::string &path)
 Returns whether the given path is a file.
 
bool rack::system::isDirectory (const std::string &path)
 Returns whether the given path is a directory.
 
uint64_t rack::system::getFileSize (const std::string &path)
 
bool rack::system::rename (const std::string &srcPath, const std::string &destPath)
 Moves a file or directory.
 
bool rack::system::copy (const std::string &srcPath, const std::string &destPath)
 Copies a file or directory recursively.
 
bool rack::system::createDirectory (const std::string &path)
 Creates a directory.
 
bool rack::system::createDirectories (const std::string &path)
 Creates all directories up to the path.
 
bool rack::system::createSymbolicLink (const std::string &target, const std::string &link)
 
bool rack::system::remove (const std::string &path)
 Deletes a file or empty directory.
 
int rack::system::removeRecursively (const std::string &path)
 Deletes a file or directory recursively.
 
std::string rack::system::getWorkingDirectory ()
 
void rack::system::setWorkingDirectory (const std::string &path)
 
std::string rack::system::getTempDirectory ()
 
std::string rack::system::getAbsolute (const std::string &path)
 Returns the absolute path beginning with "/".
 
std::string rack::system::getCanonical (const std::string &path)
 Returns the canonical (unique) path, following symlinks and "." and ".." fake directories.
 
std::string rack::system::getDirectory (const std::string &path)
 Extracts the parent directory of the path.
 
std::string rack::system::getFilename (const std::string &path)
 Extracts the filename of the path.
 
std::string rack::system::getStem (const std::string &path)
 Extracts the portion of a filename without the extension.
 
std::string rack::system::getExtension (const std::string &path)
 Extracts the extension of a filename, including the dot.
 
std::vector< uint8_t > rack::system::readFile (const std::string &path)
 Reads an entire file into a memory buffer.
 
uint8_t * rack::system::readFile (const std::string &path, size_t *size)
 
void rack::system::writeFile (const std::string &path, const std::vector< uint8_t > &data)
 Writes a memory buffer to a file, overwriting if already exists.
 
void rack::system::archiveDirectory (const std::string &archivePath, const std::string &dirPath, int compressionLevel=1)
 Compresses the contents of a directory (recursively) to an archive.
 
std::vector< uint8_t > rack::system::archiveDirectory (const std::string &dirPath, int compressionLevel=1)
 
void rack::system::unarchiveToDirectory (const std::string &archivePath, const std::string &dirPath)
 Extracts an archive into a directory.
 
void rack::system::unarchiveToDirectory (const std::vector< uint8_t > &archiveData, const std::string &dirPath)
 
int rack::system::getLogicalCoreCount ()
 Returns the number of logical simultaneous multithreading (SMT) (e.g.
 
void rack::system::setThreadName (const std::string &name)
 Sets a name of the current thread for debuggers and OS-specific process viewers.
 
std::string rack::system::getStackTrace ()
 Returns the caller's human-readable stack trace with "\n"-separated lines.
 
double rack::system::getTime ()
 Returns the number of seconds since application launch.
 
double rack::system::getUnixTime ()
 Returns time since 1970-01-01 00:00:00 UTC in seconds.
 
double rack::system::getThreadTime ()
 
void rack::system::sleep (double time)
 
std::string rack::system::getOperatingSystemInfo ()
 
void rack::system::openBrowser (const std::string &url)
 Opens a URL in a browser.
 
void rack::system::openDirectory (const std::string &path)
 Opens Windows Explorer, Finder, etc at a directory location.
 
void rack::system::runProcessDetached (const std::string &path)
 Runs an executable without blocking.
 
uint32_t rack::system::getFpuFlags ()
 Returns the CPU's floating point unit control flags.
 
void rack::system::setFpuFlags (uint32_t flags)
 
void rack::system::resetFpuFlags ()
 Sets Rack-recommended FPU flags for the current thread.
 
PRIVATE void rack::system::init ()