ALPSCore reference
Functions
alps::fs Namespace Reference

Functions

std::string get_basename (const std::string &path)
 Returns the base name of the file (removing leading directories) More...
 
std::string get_dirname (const std::string &path)
 Returns the parent direcory name of the file (removing trailing filename) More...
 
std::string get_extension (const std::string &filename)
 Returns the file name extension. More...
 
std::string remove_extensions (const std::string &filename)
 Returns the file name stem with ALL extensions removed. More...
 

Function Documentation

std::string alps::fs::get_basename ( const std::string &  path)

Returns the base name of the file (removing leading directories)

Parameters
path: pathname (e.g., /a/b/c.ver1.txt.gz)
Returns
File name (e.g., c.ver1.txt.gz)

Definition at line 66 of file filename_operations.cpp.

std::string alps::fs::get_dirname ( const std::string &  path)

Returns the parent direcory name of the file (removing trailing filename)

Parameters
path: pathname (e.g., /a/b/c.ver1.txt.gz)
Returns
Parent directory name without the trailing slash (e.g., /a/b)

Definition at line 79 of file filename_operations.cpp.

std::string alps::fs::get_extension ( const std::string &  filename)

Returns the file name extension.

Parameters
filenamefile name (e.g., "/a/b/c.ver1.txt.gz")
Returns
File name extension (e.g., ".gz")

Definition at line 14 of file filename_operations.cpp.

std::string alps::fs::remove_extensions ( const std::string &  filename)

Returns the file name stem with ALL extensions removed.

Parameters
filename: file name (e.g., /a/b/c.ver1.txt.gz)
Returns
File name stem (e.g., /a/b/c)

Definition at line 37 of file filename_operations.cpp.