Developer documentation
Version 3.0.3-105-gd3941f44
path.h File Reference
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include <string>
#include <cstdlib>
#include <cstring>
#include <cerrno>
#include <unistd.h>
#include <algorithm>
#include "exception.h"
#include "mrtrix.h"
#include "types.h"

Go to the source code of this file.

Classes

class  MR::Path::Dir
 

Namespaces

namespace  MR
 
namespace  MR::Path
 

Macros

#define HOME_ENV   "HOME"
 
#define PATH_SEPARATORS   "/"
 symbols used for separating directories in filesystem paths More...
 

Functions

std::string MR::Path::basename (const std::string &name)
 
std::string MR::Path::dirname (const std::string &name)
 
std::string MR::Path::join (const std::string &first, const std::string &second)
 
bool MR::Path::exists (const std::string &path)
 
bool MR::Path::is_dir (const std::string &path)
 
bool MR::Path::is_file (const std::string &path)
 
bool MR::Path::has_suffix (const std::string &name, const std::string &suffix)
 
bool MR::Path::has_suffix (const std::string &name, const std::initializer_list< const std::string > &suffix_list)
 
bool MR::Path::has_suffix (const std::string &name, const vector< std::string > &suffix_list)
 
bool MR::Path::is_mrtrix_image (const std::string &name)
 
std::string MR::Path::cwd ()
 
std::string MR::Path::home ()
 
char MR::Path::delimiter (const std::string &filename)
 

Macro Definition Documentation

◆ HOME_ENV

#define HOME_ENV   "HOME"

Definition at line 34 of file path.h.

◆ PATH_SEPARATORS

#define PATH_SEPARATORS   "/"

symbols used for separating directories in filesystem paths

The PATH_SEPARATORS macro contains all characters that may be used to delimit directory / file names in a filesystem path. On POSIX-compliant systems, this is simply the forward-slash character '/'; on Windows however, either forward-slashes or back-slashes can appear. Therefore any code that performs such direct manipulation of filesystem paths should both use this macro, and be written accounting for the possibility of this string containing either one or two characters depending on the target system.

Definition at line 51 of file path.h.