X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fnetradiant.git;a=blobdiff_plain;f=libs%2Fmissing.h;h=135f4d329f33d4d2db9e6a9f8f96452ec59c2943;hp=f374d1ac20ee688089b560b6241caa08fe7eb69c;hb=cc4e44e31a89c8efed942ca26e2a341466f9a3b2;hpb=99980506540d9546dad31223a6eadf126ba68121 diff --git a/libs/missing.h b/libs/missing.h index f374d1ac..135f4d32 100644 --- a/libs/missing.h +++ b/libs/missing.h @@ -34,39 +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); #ifndef APIENTRY #define APIENTRY @@ -81,6 +73,9 @@ int MemorySize(void *ptr); #define MK_CONTROL 0x0008 #define MK_MBUTTON 0x0010 +#include +#include + #endif #define CString Str @@ -209,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_