portability fixes

This commit is contained in:
Glenn Maynard
2002-12-17 08:24:11 +00:00
parent 3cb40378ac
commit fc4c96abcd
3 changed files with 5 additions and 12 deletions
+1 -1
View File
@@ -245,7 +245,7 @@ bool CreateDirectories( CString Path )
for(unsigned i = 0; i < parts.size(); ++i) for(unsigned i = 0; i < parts.size(); ++i)
{ {
curpath += parts[i] + "/"; curpath += parts[i] + "/";
if(mkdir( curpath )) if(mkdir( curpath, 0755 ))
continue; continue;
if(errno != EEXIST) if(errno != EEXIST)
+2 -10
View File
@@ -170,6 +170,7 @@ unsigned int GetHashForString( CString s );
unsigned int GetHashForFile( CString sPath ); unsigned int GetHashForFile( CString sPath );
unsigned int GetHashForDirectory( CString sDir ); // a hash value that remains the same as long as nothing in the directory has changed unsigned int GetHashForDirectory( CString sDir ); // a hash value that remains the same as long as nothing in the directory has changed
bool DoStat(CString sPath, struct stat *st);
bool DoesFileExist( const CString &sPath ); bool DoesFileExist( const CString &sPath );
bool IsAFile( const CString &sPath ); bool IsAFile( const CString &sPath );
bool IsADirectory( const CString &sPath ); bool IsADirectory( const CString &sPath );
@@ -186,16 +187,7 @@ float calc_stddev(const float *start, const float *end);
void TrimLeft(CString &str, const char *s = "\r\n\t "); void TrimLeft(CString &str, const char *s = "\r\n\t ");
void TrimRight(CString &str, const char *s = "\r\n\t "); void TrimRight(CString &str, const char *s = "\r\n\t ");
/* Fix Windows breakage ... */ #ifndef WIN32
#ifdef WIN32
#include <direct.h> /* has stuff that should be in unistd.h */
#define getcwd _getcwd
#define wgetcwd _wgetcwd
#define chdir _chdir
#define wchdir _wchdir
#define alloca _alloca
#define stat _stat
#else
#include <unistd.h> /* correct place with correct definitions */ #include <unistd.h> /* correct place with correct definitions */
#endif #endif
+2 -1
View File
@@ -12,9 +12,10 @@
#define chdir _chdir #define chdir _chdir
#define wchdir _wchdir #define wchdir _wchdir
#define alloca _alloca #define alloca _alloca
#define stat _stat #define stat _stat
#define lstat _stat #define lstat _stat
/* mkdir is missing the mode arg */
#define mkdir(p,m) mkdir(p)
#endif #endif