VCV Rack API  v1
rack::system Namespace Reference

Cross-platform functions for operating systems routines. More...

Functions

std::list< std::string > getEntries (const std::string &path)
 Returns a list of all entries (directories, files, symbols) in a directory. More...
 
std::list< std::string > getEntriesRecursive (const std::string &path, int depth)
 
bool isFile (const std::string &path)
 Returns whether the given path is a file. More...
 
bool isDirectory (const std::string &path)
 Returns whether the given path is a directory. More...
 
void moveFile (const std::string &srcPath, const std::string &destPath)
 Moves a file. More...
 
void copyFile (const std::string &srcPath, const std::string &destPath)
 Copies a file. More...
 
void createDirectory (const std::string &path)
 Creates a directory. More...
 
int getLogicalCoreCount ()
 Returns the number of logical simultaneous multithreading (SMT) (e.g. More...
 
void setThreadName (const std::string &name)
 Sets a name of the current thread for debuggers and OS-specific process viewers. More...
 
void setThreadRealTime (bool realTime)
 Sets the current thread to be high-priority. More...
 
double getThreadTime ()
 Returns the number of seconds the current thread has been active. More...
 
std::string getStackTrace ()
 Returns the caller's human-readable stack trace with "\n"-separated lines. More...
 
void openBrowser (const std::string &url)
 Opens a URL, also happens to work with PDFs and folders. More...
 
void openFolder (const std::string &path)
 Opens Windows Explorer, Finder, etc at the folder location. More...
 
void runProcessDetached (const std::string &path)
 Runs an executable without blocking. More...
 
std::string getOperatingSystemInfo ()
 
int unzipToFolder (const std::string &zipPath, const std::string &dir)
 Unzips a ZIP file to a folder. More...
 

Detailed Description

Cross-platform functions for operating systems routines.

Function Documentation

◆ getEntries()

std::list<std::string> rack::system::getEntries ( const std::string &  path)

Returns a list of all entries (directories, files, symbols) in a directory.

◆ getEntriesRecursive()

std::list<std::string> rack::system::getEntriesRecursive ( const std::string &  path,
int  depth 
)

◆ isFile()

bool rack::system::isFile ( const std::string &  path)

Returns whether the given path is a file.

◆ isDirectory()

bool rack::system::isDirectory ( const std::string &  path)

Returns whether the given path is a directory.

◆ moveFile()

void rack::system::moveFile ( const std::string &  srcPath,
const std::string &  destPath 
)

Moves a file.

◆ copyFile()

void rack::system::copyFile ( const std::string &  srcPath,
const std::string &  destPath 
)

Copies a file.

◆ createDirectory()

void rack::system::createDirectory ( const std::string &  path)

Creates a directory.

The parent directory must exist.

◆ getLogicalCoreCount()

int rack::system::getLogicalCoreCount ( )

Returns the number of logical simultaneous multithreading (SMT) (e.g.

Intel Hyperthreaded) threads on the CPU.

◆ setThreadName()

void rack::system::setThreadName ( const std::string &  name)

Sets a name of the current thread for debuggers and OS-specific process viewers.

◆ setThreadRealTime()

void rack::system::setThreadRealTime ( bool  realTime)

Sets the current thread to be high-priority.

◆ getThreadTime()

double rack::system::getThreadTime ( )

Returns the number of seconds the current thread has been active.

◆ getStackTrace()

std::string rack::system::getStackTrace ( )

Returns the caller's human-readable stack trace with "\n"-separated lines.

◆ openBrowser()

void rack::system::openBrowser ( const std::string &  url)

Opens a URL, also happens to work with PDFs and folders.

Shell injection is possible, so make sure the URL is trusted or hard coded. May block, so open in a new thread.

◆ openFolder()

void rack::system::openFolder ( const std::string &  path)

Opens Windows Explorer, Finder, etc at the folder location.

◆ runProcessDetached()

void rack::system::runProcessDetached ( const std::string &  path)

Runs an executable without blocking.

The launched process will continue running if the current process is closed.

◆ getOperatingSystemInfo()

std::string rack::system::getOperatingSystemInfo ( )

◆ unzipToFolder()

int rack::system::unzipToFolder ( const std::string &  zipPath,
const std::string &  dir 
)

Unzips a ZIP file to a folder.

The folder must exist. Returns 0 if successful.