Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


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

small bug… more to come :/

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.