X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fnetradiant.git;a=blobdiff_plain;f=libs%2Fmissing.h;h=135f4d329f33d4d2db9e6a9f8f96452ec59c2943;hp=298ef605b6bf3c99949e7e37c3734090c26c3125;hb=caadbd4cfc7aad3ac87651d06f954829de12d94a;hpb=051578cb3beb086fc56e8f548e8d93bc63302c94 diff --git a/libs/missing.h b/libs/missing.h index 298ef605..135f4d32 100644 --- a/libs/missing.h +++ b/libs/missing.h @@ -34,40 +34,31 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // NOTE TTimo // this goes along with str.h and provides various utility classes // and portability defines -// the filename is a legecy issue, it would be better to clean that up +// the file name (missing.h) is a legacy issue, it would be better to clean that up // in a central 'portability' lib #include #include #ifdef _WIN32 + +#include #include #include +#include +#include -#define MyCopyFile(a,b) CopyFile(a,b,FALSE) - -#define S_ISDIR(mode) (mode & _S_IFDIR) #define R_OK 04 -#define mymkdir(a,b) _mkdir(a) - -#else - -#define MyCopyFile CopyFile -#define mymkdir(a,b) mkdir(a,b) -#endif - -#ifndef _WIN32 +#else // !_WIN32 // LZ: very ugly hacks -inline int GetLastError () { return 0; }; +inline int GetLastError() { return 0; }; // temp stuff inline int GetPrivateProfileInt(char* a, char* b, int i, char* c) { return i; }; #define VERIFY(a) a; int GetFullPathName(const char *lpFileName, int nBufferLength, char *lpBuffer, char **lpFilePart); -bool CopyFile(const char *lpExistingFileName, const char *lpNewFileName); -bool CopyTree( const char* source, const char* dest ); #ifndef APIENTRY #define APIENTRY @@ -82,6 +73,9 @@ int MemorySize(void *ptr); #define MK_CONTROL 0x0008 #define MK_MBUTTON 0x0010 +#include +#include + #endif #define CString Str @@ -210,4 +204,34 @@ protected: }; }; +class FindFiles { +public: + FindFiles( const char *directory ); + ~FindFiles(); + + const char* NextFile(); +private: +#ifdef _WIN32 + Str directory; + HANDLE findHandle; + WIN32_FIND_DATA findFileData; +#else + DIR *findHandle; +#endif +}; + +bool CopyTree( const char* source, const char* dest ); + +typedef enum { + PATH_FAIL, // stat call failed (does not exist is likely) + PATH_DIRECTORY, + PATH_FILE +} EPathCheck; + +// check a path for existence, return directory / file +EPathCheck CheckFile( const char *path ); + +bool radCreateDirectory( const char *directory ); +bool radCopyFile( const char *lpExistingFileName, const char *lpNewFileName ); + #endif // _MISSING_H_