1 //========================================================================
5 // Miscellaneous file and directory name manipulation.
7 // Copyright 1996 Derek B. Noonburg
9 //========================================================================
21 # include <kpathsea/win32lib.h>
26 # include <sys/types.h>
28 # include "vms_dirent.h"
31 # define NAMLEN(dirent) strlen((dirent)->d_name)
33 # define dirent direct
34 # define NAMLEN(dirent) (dirent)->d_namlen
36 # include <sys/ndir.h>
51 //------------------------------------------------------------------------
53 // Get home directory path.
54 extern GString *getHomeDir();
56 // Get current directory.
57 extern GString *getCurrentDir();
59 // Append a file name to a path string. <path> may be an empty
60 // string, denoting the current directory). Returns <path>.
61 extern GString *appendToPath(GString *path, char *fileName);
63 // Grab the path from the front of the file name. If there is no
64 // directory component in <fileName>, returns an empty string.
65 extern GString *grabPath(char *fileName);
67 // Is this an absolute path or file name?
68 extern GBool isAbsolutePath(char *path);
70 // Make this path absolute by prepending current directory (if path is
71 // relative) or prepending user's directory (if path starts with '~').
72 GString *makePathAbsolute(GString *path);
74 //------------------------------------------------------------------------
76 //------------------------------------------------------------------------
81 GDirEntry(char *dirPath, char *name1, GBool doStat);
83 GString *getName() { return name; }
84 GBool isDir() { return dir; }
88 GString *name; // dir/file name
89 GBool dir; // is it a directory?
95 GDir(char *name, GBool doStat1 = gTrue);
97 GDirEntry *getNextEntry();
102 GString *path; // directory path
103 GBool doStat; // call stat() for each entry?
109 DIR *dir; // the DIR structure from opendir()
111 GBool needParent; // need to return an entry for [-]