Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 5, 2009, 10:15:05 PM (15 years ago)
Author:
rgrieder
Message:

Also synchronised sandbox_light with current trunk.

Location:
sandbox_light
Files:
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • sandbox_light

  • sandbox_light/src/libraries/core/PathConfig.cc

    r6039 r6040  
    7575        : rootPath_(*(new bf::path()))
    7676        , executablePath_(*(new bf::path()))
    77         , modulePath_(*(new bf::path()))
    7877        , dataPath_(*(new bf::path()))
    7978        , configPath_(*(new bf::path()))
     
    136135            COUT(1) << "Running from the build tree." << std::endl;
    137136            PathConfig::bDevRun_ = true;
    138             modulePath_ = specialConfig::moduleDevDirectory;
    139137        }
    140138        else
     
    151149                ThrowException(General, "Could not derive a root directory. Might the binary installation directory contain '..' when taken relative to the installation prefix path?");
    152150
    153             // Module path is fixed as well
    154             modulePath_ = rootPath_ / specialConfig::defaultModulePath;
    155 
    156151#else
    157152
    158153            // There is no root path, so don't set it at all
    159             // Module path is fixed as well
    160             modulePath_ = specialConfig::moduleInstallDirectory;
    161154
    162155#endif
     
    168161        delete &rootPath_;
    169162        delete &executablePath_;
    170         delete &modulePath_;
    171163        delete &dataPath_;
    172164        delete &configPath_;
     
    242234    }
    243235
    244     std::vector<std::string> PathConfig::getModulePaths()
    245     {
    246         std::vector<std::string> modulePaths;
    247 
    248         // We search for helper files with the following extension
    249         std::string moduleextension = specialConfig::moduleExtension;
    250         size_t moduleextensionlength = moduleextension.size();
    251 
    252         // Add that path to the PATH variable in case a module depends on another one
    253         std::string pathVariable = getenv("PATH");
    254         putenv(const_cast<char*>(("PATH=" + pathVariable + ";" + modulePath_.string()).c_str()));
    255 
    256         // Make sure the path exists, otherwise don't load modules
    257         if (!boost::filesystem::exists(modulePath_))
    258             return modulePaths;
    259 
    260         boost::filesystem::directory_iterator file(modulePath_);
    261         boost::filesystem::directory_iterator end;
    262 
    263         // Iterate through all files
    264         while (file != end)
    265         {
    266             std::string filename = file->BOOST_LEAF_FUNCTION();
    267 
    268             // Check if the file ends with the exension in question
    269             if (filename.size() > moduleextensionlength)
    270             {
    271                 if (filename.substr(filename.size() - moduleextensionlength) == moduleextension)
    272                 {
    273                     // We've found a helper file
    274                     std::string library = filename.substr(0, filename.size() - moduleextensionlength);
    275                     modulePaths.push_back((modulePath_ / library).file_string());
    276                 }
    277             }
    278             ++file;
    279         }
    280 
    281         return modulePaths;
    282     }
    283 
    284236    /*static*/ std::string PathConfig::getRootPathString()
    285237    {
     
    306258        return getInstance().logPath_.string() + '/';
    307259    }
    308 
    309     /*static*/ std::string PathConfig::getModulePathString()
    310     {
    311         return getInstance().modulePath_.string() + '/';
    312     }
    313260}
Note: See TracChangeset for help on using the changeset viewer.