HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
UT_DirUtil.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: UT_DirUtil.C (UT Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef _UT_DIRUTIL_H_
12 #define _UT_DIRUTIL_H_
13 
14 #include "UT_API.h"
15 #include "UT_FileStat.h"
16 #include <SYS/SYS_Deprecated.h>
17 
18 #include <time.h>
19 
20 class UT_FileStat;
21 class UT_String;
22 class UT_StringArray;
23 
24 UT_API int UTunixFullPathSpecified(const char *name);
25 UT_API int UTfullPathSpecified(const char *name);
26 UT_API int UTisValidDirectory(const char *path);
27 // This, unlike, UTfullPathSpecified, returns false for ./filename
28 UT_API bool UTisAbsolutePath(const char *filename);
29 UT_API bool UTisRootPath(const char *filename);
30 UT_API void UTmakeAbsoluteFilePath(UT_String &path, const char *basepath=NULL);
32 UT_API void UTaddAbsolutePathPrefix(const char *prefix);
33 
34 // Please pass in just the filename and not the entire path.
35 UT_API bool UTisHiddenFile(const char *filename);
36 
37 /// Returns true if the given path is a readable, _regular_ file, ie. not a
38 /// directory.
39 UT_API bool UTisValidRegularFile(const char *path);
40 
41 #ifdef WIN32
42  #include <sys/types.h>
43  #include <direct.h>
44  #include <errno.h>
45 
46  // Define dummy value to compare with errno in assertions related
47  // to Linux libraries and large file systems. This define now exists on
48  // newer versions of Visual Studio. The current value is defined to be the
49  // same as the one found in VC10.
50  #ifndef EOVERFLOW
51  #define EOVERFLOW 132
52  #endif
53 
54  typedef void* DIR;
55  struct dirent {
56  char *d_name;
57  };
58  UT_API DIR *opendir( const char *name );
59  UT_API struct dirent *readdir( DIR *dirp );
60  UT_API void closedir( DIR *dirp );
61 
62  /// Get the current working directory
63  UT_API char *getUnixCwd( char *buffer, int maxlen );
64 #else
65  #include <sys/types.h>
66  #include <sys/stat.h>
67  #include <string.h>
68  #include <dirent.h>
69  #include <unistd.h>
70  #include <stdlib.h>
71 
72  /// Get the current working directory
73  UT_API char *getUnixCwd( char *buffer, int maxlen );
74 #endif
75 
76 /// Do the equivalent of a stat on the last file from readdir or opendir.
77 UT_API int statLastRead(DIR *dirp, const char *path, UT_FileStat &file_stat);
78 
79 #endif
80 
UT_API bool UTisHiddenFile(const char *filename)
UT_API int UTunixFullPathSpecified(const char *name)
UT_API bool UTisRootPath(const char *filename)
GLsizei const GLchar *const * path
Definition: glcorearb.h:3340
UT_API const UT_StringArray & UTgetAbsolutePathPrefixes()
#define UT_API
Definition: UT_API.h:12
GLuint buffer
Definition: glcorearb.h:659
UT_API void UTmakeAbsoluteFilePath(UT_String &path, const char *basepath=NULL)
UT_API int UTfullPathSpecified(const char *name)
GLuint const GLchar * name
Definition: glcorearb.h:785
UT_API void UTaddAbsolutePathPrefix(const char *prefix)
UT_API char * getUnixCwd(char *buffer, int maxlen)
Get the current working directory.
UT_API int UTisValidDirectory(const char *path)
UT_API bool UTisAbsolutePath(const char *filename)
UT_API int statLastRead(DIR *dirp, const char *path, UT_FileStat &file_stat)
Do the equivalent of a stat on the last file from readdir or opendir.
UT_API bool UTisValidRegularFile(const char *path)