Changeset 7204 in orxonox.OLD for branches/std/src/lib
- Timestamp:
- Mar 9, 2006, 6:10:22 PM (19 years ago)
- Location:
- branches/std/src/lib
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/std/src/lib/gui/gtk_gui/gui_exec.cc
r7203 r7204 166 166 void GuiExec::setConfFile(const char* fileName) 167 167 { 168 if ( !this->confDir.empty())168 if (this->confDir.empty()) 169 169 this->setConfDir("~/"); 170 170 this->confFile = this->confDir + "/" + fileName; -
branches/std/src/lib/parser/ini_parser/ini_parser.cc
r7203 r7204 68 68 { 69 69 // in all sections 70 while(!this->sections.empty()) 71 { 72 IniSection section = this->sections.front(); 73 74 // in all entries of the sections 75 while(!section.entries.empty()) 76 { 77 // delete all strings of entries. 78 IniEntry entry = section.entries.front(); 79 section.entries.pop_front(); 80 } 81 // delete all Sections 82 this->sections.pop_front(); 83 } 70 this->sections.clear(); 71 84 72 this->currentSection = this->sections.end(); 85 73 this->setFileName(NULL); … … 95 83 { 96 84 this->comment = ""; 97 98 if (!fileName.empty()) 99 this->fileName = fileName; 100 else 101 this->fileName = ""; 85 this->fileName = fileName; 102 86 } 103 87 … … 118 102 if (!this->fileName.empty()) 119 103 this->deleteSections(); 104 120 105 if( fileName.empty()) 121 106 return false; … … 151 136 if ( (*lineBegin == '#' || *lineBegin == ';')) 152 137 { 153 char* newCommenLine = new char[strlen(lineBegin)+1]; 154 strcpy(newCommenLine, lineBegin); 138 string newCommenLine = lineBegin; 155 139 this->commentList.push_back(newCommenLine); 156 140 continue; … … 276 260 if (!this->sections.empty()) 277 261 this->currentEntry = (*this->currentSection).entries.begin(); 278 PRINTF(5)("Added Section %s\n", sectionName );262 PRINTF(5)("Added Section %s\n", sectionName.c_str()); 279 263 return true; 280 264 } -
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.