Changeset 7611 in orxonox.OLD for branches/qt_gui
- Timestamp:
- May 12, 2006, 4:15:39 PM (19 years ago)
- Location:
- branches/qt_gui/src/lib
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/qt_gui/src/lib/Makefile.am
r7610 r7611 25 25 util/preferences.cc \ 26 26 util/threading.cc \ 27 util/file.cc \ 27 28 util/directory.cc \ 28 29 \ … … 44 45 util/preferences.h \ 45 46 util/threading.h \ 47 util/file.h \ 46 48 util/directory.h \ 47 49 \ -
branches/qt_gui/src/lib/util/file.cc
r7609 r7611 14 14 */ 15 15 16 #include "file.h" 16 17 18 #ifdef __unix__ 19 #include <unistd.h> 20 #elif __WIN32__ || _MS_DOS_ 21 #include <dir.h> 22 #else 23 #include <direct.h> 24 #endif 25 26 27 28 File::File() 29 { 30 #warning implement 31 } 32 33 File::File(const std::string& fileName) 34 { 35 #warning implement 36 } 37 38 File::File(const File& file) 39 { 40 #warning implement 41 } 42 43 File::~File() 44 { 45 #warning implement 46 } 47 48 bool File::open(OpenMode mode) 49 { 50 #warning implement 51 } 52 bool File::close() 53 { 54 #warning implement 55 } 56 int File::handle() 57 { 58 #warning implement 59 } 60 61 bool File::exists() 62 { 63 #warning implement 64 } 65 bool File::isLink() 66 { 67 #warning implement 68 } // only on UNIX 69 bool File::isFile() 70 { 71 #warning implement 72 } 73 bool File::isDirectory() 74 { 75 #warning implement 76 } 77 bool File::isReadeable() 78 { 79 #warning implement 80 } 81 bool File::isWriteable() 82 { 83 #warning implement 84 } 85 bool File::isExecutable() 86 { 87 #warning implement 88 } 89 90 91 bool File::copy(const File& destination) 92 { 93 #warning implement 94 } 95 bool File::rename(const File& destination) 96 { 97 #warning implement 98 } 99 bool File::touch() 100 { 101 #warning implement 102 } 103 bool File::remove() 104 { 105 #warning implement 106 } 107 108 void File::relToAbs(std::string& fileName) 109 { 110 #warning implement 111 } 112 void File::absToRel(std::string& fileName) 113 { 114 #warning implement 115 } 116 117 118 119 120 std::string File::_cwd = ""; 121 122 /** 123 * @returns the Current Woring Directory 124 */ 125 const std::string& File::cwd() 126 { 127 if (File::_cwd.empty()) 128 { 129 char cwd[1024]; 130 char* errorCode = getcwd(cwd, 1024); 131 if (errorCode == 0) 132 return File::_cwd; 133 134 File::_cwd = cwd; 135 } 136 return File::_cwd; 137 } 138 139 140 141 #include "file.h" 142 143 -
branches/qt_gui/src/lib/util/file.h
r7609 r7611 32 32 33 33 bool exists(); 34 bool isLink(); // only on UNIX34 bool isLink(); // only on UNIX 35 35 bool isFile(); 36 bool isDirectory(); 36 37 bool isReadeable(); 37 38 bool isWriteable(); … … 45 46 46 47 static void relToAbs(std::string& fileName); 48 static void absToRel(std::string& fileName); 49 static const std::string& cwd(); 47 50 48 51 private: … … 50 53 51 54 private: 52 int _handle; //!< The FileHandle (if set). 53 std::string name; //!< The Name of the File. 55 int _handle; //!< The FileHandle (if set). 56 std::string name; //!< The Name of the File. 57 58 static std::string _cwd; //!< The currend Working directory. 54 59 }; 55 60 -
branches/qt_gui/src/lib/util/loading/resource_manager.cc
r7460 r7611 17 17 18 18 #include "util/loading/resource_manager.h" 19 19 #include "file.h" 20 20 #include "substring.h" 21 21 #include "debug.h" … … 60 60 61 61 this->dataDir = "./"; 62 this->_cwd = "";63 62 this->tryDataDir("./data"); 64 63 } … … 874 873 if (name[0] == '.' && name[1] != '.') 875 874 retName.erase(0); 876 const std::string& absDir = ResourceManager::cwd();875 const std::string& absDir = File::cwd(); 877 876 retName = absDir + retName; 878 877 } … … 896 895 else 897 896 return ""; 898 }899 900 #ifdef __unix__901 #include <unistd.h>902 #elif __WIN32__ || _MS_DOS_903 #include <dir.h>904 #else905 #include <direct.h> /* Visual C++ */906 #endif907 /**908 * @returns the Current Woring Directory909 */910 const std::string& ResourceManager::cwd()911 {912 if (ResourceManager::getInstance()->_cwd.empty())913 {914 char cwd[1024];915 char* errorCode = getcwd(cwd, 1024);916 if (errorCode == 0)917 return ResourceManager::getInstance()->_cwd;918 919 ResourceManager::getInstance()->_cwd = cwd;920 }921 return ResourceManager::getInstance()->_cwd;922 897 } 923 898 -
branches/qt_gui/src/lib/util/loading/resource_manager.h
r7225 r7611 138 138 static bool isInDataDir(const std::string& fileName); 139 139 static std::string getAbsDir(const std::string& fileName); 140 static const std::string& cwd();141 140 142 141 static const char* ResourceTypeToChar(ResourceType type); … … 151 150 static ResourceManager* singletonRef; //!< singleton Reference 152 151 153 std::string _cwd; //!< The currend Working directory.154 152 std::string dataDir; //!< The Data Directory, where all relevant Data is stored. 155 153 std::vector<std::string> imageDirs; //!< A list of directories in which images are stored.
Note: See TracChangeset
for help on using the changeset viewer.