1 //========================================================================
5 // Miscellaneous file and directory name manipulation.
7 // Copyright 1996 Derek B. Noonburg
9 //========================================================================
17 # include <kpathsea/win32lib.h>
20 # include <sys/types.h>
22 # include "vms_dirent.h"
25 # define NAMLEN(dirent) strlen((dirent)->d_name)
27 # define dirent direct
28 # define NAMLEN(dirent) (dirent)->d_namlen
30 # include <sys/ndir.h>
44 //------------------------------------------------------------------------
46 // Get home directory path.
47 extern GString *getHomeDir();
49 // Get current directory.
50 extern GString *getCurrentDir();
52 // Append a file name to a path string. <path> may be an empty
53 // string, denoting the current directory). Returns <path>.
54 extern GString *appendToPath(GString *path, char *fileName);
56 // Grab the path from the front of the file name. If there is no
57 // directory component in <fileName>, returns an empty string.
58 extern GString *grabPath(char *fileName);
60 // Is this an absolute path or file name?
61 extern GBool isAbsolutePath(char *path);
63 // Make this path absolute by prepending current directory (if path is
64 // relative) or prepending user's directory (if path starts with '~').
65 GString *makePathAbsolute(GString *path);
67 //------------------------------------------------------------------------
69 //------------------------------------------------------------------------
74 GDirEntry(char *dirPath, char *name1, GBool doStat);
76 GString *getName() { return name; }
77 GBool isDir() { return dir; }
81 GString *name; // dir/file name
82 GBool dir; // is it a directory?
88 GDir(char *name, GBool doStat1 = gTrue);
90 GDirEntry *getNextEntry();
95 GString *path; // directory path
96 GBool doStat; // call stat() for each entry?
98 GBool needParent; // need to return an entry for [-]
104 DIR *dir; // the DIR structure from opendir()