Exemplo n.º 1
0
   /** load all dlls in dir and check for plugin factories */
   void ComponentPluginManager::LoadPluginsInDir(const std::string& path)
   {
      std::string cleanedPath(path);
      if (path[path.size() - 1] == GetNativePathSeparator())
      {
         // remove the trailing path separator as this causes issues...
         cleanedPath = path.substr(0, path.size() - 1);
      }

      if(!GetSystemInterface()->FileExists(cleanedPath))
      {
         LOG_ALWAYS("Plugin folder not found! Path: " + cleanedPath);
         return;
      }

      std::string libExtension = GetLibExtension();
      LOG_DEBUG("Looking for plugins with extension: " + libExtension);

      // get libs from directory
      SystemInterface::DirectoryContents files = GetSystemInterface()->GetDirectoryContents(cleanedPath);

      // for each library in dir
      SystemInterface::DirectoryContents::const_iterator i;
      for(i = files.begin(); i != files.end(); ++i)
      {
         std::string fileName = *i;

         if(fileName.size() <= libExtension.size())
            continue;

         std::string ending = fileName.substr(fileName.size() - libExtension.size(), fileName.size());
         if(ending.compare(libExtension) != 0)
         {
            continue;
         }

         std::ostringstream libpath;
         libpath << cleanedPath << GetNativePathSeparator() << fileName;
         AddPlugin(libpath.str());
         LOG_DEBUG("Loaded plugin: " + libpath.str());
      }
   }
Exemplo n.º 2
0
std::string& FileSystem::FixSlashes(std::string& path)
{
	const char sep = GetNativePathSeparator();
	for (size_t i = 0; i < path.size(); ++i) {
		if (path[i] == '/' || path[i] == '\\') {
			path[i] = sep;
		}
	}

	return path;
}
Exemplo n.º 3
0
const std::string& FileSystem::GetCacheDir()
{
	// cache-dir versioning must not be too finegrained,
	// we do want to regenerate cache after every commit
	//
	// release builds must however also *never* use the
	// same directory as any previous development build
	// (regardless of branch), so keep caches separate
	static const std::string cacheType[2] = {"dev-", "rel-"};
	static const std::string cacheBaseDir = "cache";
	static const std::string cacheVersion = SpringVersion::GetMajor() + cacheType[SpringVersion::IsRelease()] + SpringVersion::GetBranch();
	static const std::string cacheDir = cacheBaseDir + GetNativePathSeparator() + cacheVersion;

	return cacheDir;
}