Rapicorn - Experimental UI Toolkit  16.0.0
Rapicorn::Path Namespace Reference

The Path namespace provides functions for file path manipulation and testing. More...

Functions

String dirname (const String &path)
 
String basename (const String &path)
 
String realpath (const String &path)
 
String abspath (const String &path, const String &incwd)
 
bool isabs (const String &path)
 
bool isdirname (const String &path)
 
String skip_root (const String &path)
 
String join (const String &frag0, const String &frag1, const String &frag2, const String &frag3, const String &frag4, const String &frag5, const String &frag6, const String &frag7, const String &frag8, const String &frag9, const String &frag10, const String &frag11, const String &frag12, const String &frag13, const String &frag14, const String &frag15)
 
bool check (const String &file, const String &mode)
 
bool equals (const String &file1, const String &file2)
 
String cwd ()
 Return the current working directoy, including symlinks used in $PWD if available.
 
StringVector searchpath_split (const String &searchpath)
 
String searchpath_find (const String &searchpath, const String &file, const String &mode)
 
String searchpath_join (const String &frag0, const String &frag1, const String &frag2, const String &frag3, const String &frag4, const String &frag5, const String &frag6, const String &frag7, const String &frag8, const String &frag9, const String &frag10, const String &frag11, const String &frag12, const String &frag13, const String &frag14, const String &frag15)
 
String vpath_find (const String &file, const String &mode)
 
charmemread (const String &filename, size_t *lengthp)
 
void memfree (char *memread_mem)
 
bool memwrite (const String &filename, size_t len, const uint8 *bytes)
 

Variables

const String dir_separator
 
const String searchpath_separator
 

Detailed Description

The Path namespace provides functions for file path manipulation and testing.

Function Documentation

String Rapicorn::Path::abspath ( const String path,
const String incwd 
)
Parameters
patha filename path
incwdoptional current working directory

Complete path to become an absolute file path. If neccessary, incwd or the real current working directory is prepended.

String Rapicorn::Path::basename ( const String path)
Parameters
patha filename path

Strips all directory components from path and returns the resulting file name.

Referenced by Rapicorn::ApplicationImpl::auto_path().

bool Rapicorn::Path::check ( const String file,
const String mode 
)
Parameters
filepossibly relative filename
modefeature string
Returns
true if file adhears to mode

Perform various checks on file and return whether all checks passed. On failure, errno is set appropriately, and FALSE is returned. Available features to be checked for are:

  • e - file must exist
  • r - file must be readable
  • w - file must be writable
  • x - file must be executable
  • f - file must be a regular file
  • d - file must be a directory
  • l - file must be a symbolic link
  • c - file must be a character device
  • b - file must be a block device
  • p - file must be a named pipe
  • s - file must be a socket.

Referenced by Rapicorn::ApplicationImpl::auto_path().

String Rapicorn::Path::dirname ( const String path)
Parameters
patha filename path

Return the directory part of a file name.

Referenced by Rapicorn::ApplicationImpl::auto_path().

bool Rapicorn::Path::equals ( const String file1,
const String file2 
)
Parameters
file1possibly relative filename
file2possibly relative filename
Returns
TRUE if file1 and file2 are equal

Check whether file1 and file2 are pointing to the same inode in the same file system on the same device.

bool Rapicorn::Path::isabs ( const String path)
Parameters
patha filename path

Return wether path is an absolute pathname.

Referenced by abspath(), and Rapicorn::ApplicationImpl::auto_path().

bool Rapicorn::Path::isdirname ( const String path)
Parameters
patha filename path

Return wether path is pointing to a directory component.

Referenced by Rapicorn::ApplicationImpl::auto_path().

String Rapicorn::Path::realpath ( const String path)
Parameters
patha filename path

Resolve links and directory references in path and provide a canonicalized absolute pathname.