Functions

VR3File Namespace Reference

File functions namespace. More...

Functions

bool RealPath (const std::string &path, std::string &resolvedpath)
 Extracts the real path of a given file.
void DirBaseSplit (const std::string &path, std::string &dir, std::string &base)
 Splits the given path into the dir and base components.
bool ChdirGetcwd (const std::string &dir, std::string &path)
 Gets the real path of a directory using the chdir and getcwd function.

Detailed Description

File functions namespace.


Function Documentation

bool VR3File::ChdirGetcwd ( const std::string &  dir,
std::string &  path 
)

Gets the real path of a directory using the chdir and getcwd function.

This function extracts the absolute path of a directory. The directory is specified with the dir parameter (relative or absolute path). Using the chdir() and getcwd() functions the desired directory absolute path is stored in path.

Parameters:
[in]dirThe directory input path
[out]pathThe directory absolute path
Returns:
true on success, false on failure
void VR3File::DirBaseSplit ( const std::string &  path,
std::string &  dir,
std::string &  base 
)

Splits the given path into the dir and base components.

This function parses the given path string and splits it in two parts:

  • dir: everything before the final slash (or backslash if Windows, included)
  • base: everything after the final slash (or backslash if Windows)
Parameters:
[in]pathThe given path
[out]dirThe dir part of the path
[out]baseThe base part of the path
bool VR3File::RealPath ( const std::string &  path,
std::string &  resolvedpath 
)

Extracts the real path of a given file.

This function is used to obtain the absolute path of a given file using only its (maybe relative) user-provided path. The function implementation structure is the same on windows and linux, but we use different (even if equivalent) functions:

  • Windows: Implemented using ISO C++ conformant _getcwd() and _chdir()
  • Linux: Implemented using POSIX getcwd() and chdir() (symbolic links are not resolved)
Parameters:
[in]pathThe user-provided file path
[out]resolvedpathThe resulting absolute path
Returns:
true on success, false on failure
 All Classes Namespaces Files Functions Variables Typedefs Friends Defines