![]() |
Jetson Inference
DNN Vision Library
|
network Networking TCP/UDP sockets and IP address manipulation. More...
Functions | |
std::string | absolutePath (const std::string &relative_path) |
Given a relative path, resolve the absolute path based on the location of the process that calls the function. More... | |
std::string | locateFile (const std::string &path) |
Return a list of all the files in the specified directory. More... | |
std::string | locateFile (const std::string &path, std::vector< std::string > &locations) |
Locate a file from a set of locations provided by the user, in addition to common system locations such as "/opt" and "/usr/local". More... | |
bool | fileExists (const char *path, bool regularFilesOnly=false) |
Verify path and return true if the file exists. More... | |
size_t | fileSize (const char *path) |
Return the size (in bytes) of the specified file. More... | |
std::string | filePath (const std::string &filename) |
Extract the path out of the supplied string, removing the filename and extension For example, filePath("~/user/somefile.xml") would return ~/user More... | |
std::string | fileExtension (const std::string &path) |
Extract the file extension from the path. More... | |
std::string | fileRemoveExtension (const std::string &filename) |
Return the input string with the file extension removed For example, strRemoveExtension("~/user/somefile.xml") would return ~/user/somefile . More... | |
std::string | fileChangeExtension (const std::string &filename, const std::string &newExtension) |
Return the input string with a changed file extension For example, strChangeExtension("~/user/somefile.xml", "zip") would return ~/user/somefile.zip . More... | |
std::string | processPath () |
Return the absolute path that of the calling process executable, include the process executable's filename. More... | |
std::string | processDirectory () |
Return the directory that the calling process resides in. More... | |
std::string | workingDirectory () |
Return the current working directory of the calling process. More... | |
network Networking TCP/UDP sockets and IP address manipulation.
Functions for listing files in directories and manipulating file paths.
std::string absolutePath | ( | const std::string & | relative_path | ) |
Given a relative path, resolve the absolute path based on the location of the process that calls the function.
For example, if the application is located at "/home/user/my_process" and absolutePath("resources/example")
is called, then this function would return the path "/home/user/resources/example".
std::string fileChangeExtension | ( | const std::string & | filename, |
const std::string & | newExtension | ||
) |
Return the input string with a changed file extension For example, strChangeExtension("~/user/somefile.xml", "zip")
would return ~/user/somefile.zip
.
bool fileExists | ( | const char * | path, |
bool | regularFilesOnly = false |
||
) |
Verify path and return true if the file exists.
regularFilesOnly | If false (which is the default), then sysFileExists() includes filesystem entries like directories, device files, and sockets when verifying the path. |
If regularFilesOnly parameter is true, then sysFileExists() will verify the path is to a readable, "regular" file. Other file types (for example directories) will result in sysFileExists() returning false.
std::string fileExtension | ( | const std::string & | path | ) |
Extract the file extension from the path.
This function will return all contents of the path to the right of the right-most `'.'` The extension will be returned in all lowercase characters.
std::string filePath | ( | const std::string & | filename | ) |
Extract the path out of the supplied string, removing the filename and extension For example, filePath("~/user/somefile.xml")
would return ~/user
std::string fileRemoveExtension | ( | const std::string & | filename | ) |
Return the input string with the file extension removed For example, strRemoveExtension("~/user/somefile.xml")
would return ~/user/somefile
.
size_t fileSize | ( | const char * | path | ) |
Return the size (in bytes) of the specified file.
path | the path of the file |
std::string locateFile | ( | const std::string & | path | ) |
Return a list of all the files in the specified directory.
path | the path of the directory |
list | the output list of all files in the directory |
includePath | if true, the list of filenames will be prefixed with the path if false (default), the list of filenames will contain filenames/extensions only Locate a file from common system locations. First, this function will check if the file exists at the path provided, and if not it will check for the existance of the file in common system locations such as "/opt", "/usr/local", and "/usr/local/bin". |
std::string locateFile | ( | const std::string & | path, |
std::vector< std::string > & | locations | ||
) |
Locate a file from a set of locations provided by the user, in addition to common system locations such as "/opt" and "/usr/local".
std::string processDirectory | ( | ) |
Return the directory that the calling process resides in.
For example, if the process executable is located at /usr/bin/exe
, then processDirectory()
would return the path /usr/bin
.
std::string processPath | ( | ) |
Return the absolute path that of the calling process executable, include the process executable's filename.
std::string workingDirectory | ( | ) |
Return the current working directory of the calling process.