33 #include <sys/types.h>    56         if (errno == ENOENT) 
return;
    71             if (name == 
"." || name == 
"..")
    73             if (unlink((dirname + 
"/" + name).c_str())) {
    78     if (rmdir(dirname.c_str())) {
    86 has_drive(
const string &path)
    88     return (path.size() >= 2 && path[1] == 
':');
    93 uncw_path(
const string & path)
    95     return (path.size() >= 4 && memcmp(path.data(), 
"\\\\?\\", 4) == 0);
    98 static inline bool slash(
char ch)
   100     return ch == 
'/' || ch == 
'\\';
   108     if (path.empty() || path[0] != 
'/') {
   110         string::size_type last_slash = base.rfind(
'/');
   111         if (last_slash != string::npos)
   112             path.insert(0, base, 0, last_slash + 1);
   117     bool drive = has_drive(path);
   118     string::size_type p = (drive ? 2 : 0);
   119     bool absolute = (p != path.size() && slash(path[p]));
   127         if (has_drive(base)) {
   128             path.insert(0, base, 0, 2);
   134         if (uncw_path(base)) {
   135             string::size_type sl = 0;
   136             if (base.size() >= 7 && memcmp(base.data() + 5, 
":\\", 2) == 0) {
   139             } 
else if (base.size() >= 8 &&
   140                        memcmp(base.data() + 4, 
"UNC\\", 4) == 0) {
   142                 sl = base.find(
'\\', 8);
   143                 if (sl != string::npos)
   144                     sl = base.find(
'\\', sl + 1);
   150                 for (i = path.begin(); i != path.end(); ++i) {
   154                 path.insert(0, base, 0, sl);
   156         } 
else if (base.size() >= 5 && slash(base[0]) && slash(base[1])) {
   158             string::size_type sl = base.find_first_of(
"/\\", 2);
   159             if (sl != string::npos) {
   160                 sl = base.find_first_of(
"/\\", sl + 1);
   161                 path.insert(0, base, 0, sl);
   169     bool base_drive = has_drive(base);
   170     if (!drive || (base_drive && (path[0] | 32) == (base[0] | 32))) {
   171         string::size_type last_slash = base.find_last_of(
"/\\");
   172         if (last_slash == string::npos && !drive && base_drive)
   174         if (last_slash != string::npos) {
   175             string::size_type b = (drive && base_drive ? 2 : 0);
   176             if (uncw_path(base)) {
   180                 for (i = path.begin(); i != path.end(); ++i) {
   185             path.insert(b, base, b, last_slash + 1 - b);
 
struct dirent * readdir(DIR *)
 
include <dirent.h>, with alternative implementation for windows. 
 
Hierarchy of classes which Xapian can throw as exceptions. 
 
DIR * opendir(const char *)
 
void resolve_relative_path(string &path, const string &base)
Resolve path relative to base. 
 
<unistd.h>, but with compat. 
 
void removedir(const string &dirname)
Remove a directory, and its contents. 
 
DatabaseError indicates some sort of database related error. 
 
File and path manipulation routines.