root/trunk/cs_filefunctions.h

Revision 5, 1.0 kB (checked in by qbert, 6 years ago)

Initial ( and last :( ) commit

Line 
1 #ifndef CS_FILEFUNCTIONS_H
2 #define CS_FILEFUNCTIONS_H
3
4 #include <string>
5 #include <vector>
6 using std::string;
7 using std::vector;
8
9
10
11 void GetMyFiles(const string& dir, vector<string> &files);
12 void GetMyDirs(const string& dir, vector<string> &files);
13
14
15 inline string GetCD() {
16 #ifdef _UNICODE
17     wchar_t  dir[MAX_PATH+sizeof(wchar_t)];
18     if (!GetCurrentDirectory(MAX_PATH,dir)) return "none_found";
19     return dir;
20
21
22 #else
23     char  dir[MAX_PATH];
24     if (!GetCurrentDirectory(MAX_PATH,dir)) return "none_found";
25     return dir;
26 #endif
27 }
28
29 inline bool DirectoryExists(const string &name) {
30     DWORD Code = GetFileAttributes(name.c_str());
31     return (Code != -1) && (Code & FILE_ATTRIBUTE_DIRECTORY );
32 }
33 inline bool FileExists(const string &name) { return (GetFileAttributes(name.c_str()) != 0xFFFFFFFF); }
34
35    
36 BOOL EmptyDirectory(CString &sPath);
37 int GetMyVersion();
38
39
40 // This is a recursive function which empty a directory path
41 // of its files and call itself if necessary to delete
42 // subdirectories.
43
44 #endif
Note: See TracBrowser for help on using the browser.