Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7204 in orxonox.OLD for branches/std/src/lib


Ignore:
Timestamp:
Mar 9, 2006, 6:10:22 PM (19 years ago)
Author:
bensch
Message:

small bug… more to come :/

Location:
branches/std/src/lib
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/std/src/lib/gui/gtk_gui/gui_exec.cc

    r7203 r7204  
    166166void GuiExec::setConfFile(const char* fileName)
    167167{
    168   if (!this->confDir.empty())
     168  if (this->confDir.empty())
    169169    this->setConfDir("~/");
    170170  this->confFile = this->confDir + "/" + fileName;
  • branches/std/src/lib/parser/ini_parser/ini_parser.cc

    r7203 r7204  
    6868{
    6969  // 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
    8472  this->currentSection = this->sections.end();
    8573  this->setFileName(NULL);
     
    9583{
    9684  this->comment = "";
    97 
    98   if (!fileName.empty())
    99     this->fileName = fileName;
    100   else
    101     this->fileName = "";
     85  this->fileName = fileName;
    10286}
    10387
     
    118102  if (!this->fileName.empty())
    119103    this->deleteSections();
     104
    120105  if( fileName.empty())
    121106    return false;
     
    151136      if ( (*lineBegin == '#' || *lineBegin == ';'))
    152137      {
    153         char* newCommenLine = new char[strlen(lineBegin)+1];
    154         strcpy(newCommenLine, lineBegin);
     138        string newCommenLine = lineBegin;
    155139        this->commentList.push_back(newCommenLine);
    156140        continue;
     
    276260  if (!this->sections.empty())
    277261    this->currentEntry = (*this->currentSection).entries.begin();
    278   PRINTF(5)("Added Section %s\n", sectionName);
     262  PRINTF(5)("Added Section %s\n", sectionName.c_str());
    279263  return true;
    280264}
  • branches/std/src/lib/util/loading/resource_manager.cc

    r7203 r7204  
    5959  this->setName("ResourceManager");
    6060
    61   this->dataDir = new char[3];
    6261  this->dataDir = "./";
     62  this->_cwd = "";
    6363  this->tryDataDir("./data");
    6464}
     
    789789bool ResourceManager::isFile(const std::string& fileName)
    790790{
     791  if (fileName.empty())
     792    return false;
    791793  std::string tmpFileName = ResourceManager::homeDirCheck(fileName);
    792794  // actually checks the File
     
    840842 * @param name the Name of the file to check
    841843 * @returns The name of the file, including the HomeDir
    842  * IMPORTANT: this has to be deleted from the outside
    843844 */
    844845std::string ResourceManager::homeDirCheck(const std::string& name)
    845846{
    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);
    850851#ifdef __WIN32__
    851     strcpy(tmpFileName, getenv("USERPROFILE"));
     852    homeDir = getenv("USERPROFILE");
    852853#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;
    862860}
    863861
Note: See TracChangeset for help on using the changeset viewer.