Changeset 7204 in orxonox.OLD for branches/std/src/lib/util
- Timestamp:
- Mar 9, 2006, 6:10:22 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/std/src/lib/util/loading/resource_manager.cc
r7203 r7204 59 59 this->setName("ResourceManager"); 60 60 61 this->dataDir = new char[3];62 61 this->dataDir = "./"; 62 this->_cwd = ""; 63 63 this->tryDataDir("./data"); 64 64 } … … 789 789 bool ResourceManager::isFile(const std::string& fileName) 790 790 { 791 if (fileName.empty()) 792 return false; 791 793 std::string tmpFileName = ResourceManager::homeDirCheck(fileName); 792 794 // actually checks the File … … 840 842 * @param name the Name of the file to check 841 843 * @returns The name of the file, including the HomeDir 842 * IMPORTANT: this has to be deleted from the outside843 844 */ 844 845 std::string ResourceManager::homeDirCheck(const std::string& name) 845 846 { 846 std::string retName;847 if (!strncmp(name.c_str(), "~/", 2))848 {849 char tmpFileName[500];847 if (name.size() >= 2 && name[0] == '~' && name[1] == '/') 848 { 849 std::string homeDir; 850 std::string newName = name.substr(1, name.size()-1); 850 851 #ifdef __WIN32__ 851 strcpy(tmpFileName, getenv("USERPROFILE"));852 homeDir = getenv("USERPROFILE"); 852 853 #else 853 strcpy(tmpFileName, getenv("HOME")); 854 #endif 855 retName = tmpFileName + name; 856 } 857 else 858 { 859 retName = name; 860 } 861 return retName; 854 homeDir = getenv("HOME"); 855 #endif 856 return homeDir + newName; 857 } 858 else 859 return name; 862 860 } 863 861
Note: See TracChangeset
for help on using the changeset viewer.