Utils::FileName AndroidManager::manifestSourcePath(ProjectExplorer::Target *target) { if (AndroidQtSupport *androidQtSupport = AndroidManager::androidQtSupport(target)) { Utils::FileName source = androidQtSupport->manifestSourcePath(target); if (!source.isEmpty()) return source; } return manifestPath(target); }
void Host::ReadModuleManifest(std::string& modulePath) { Poco::Path manifestPath(modulePath); Poco::Path moduleTopDir = manifestPath.parent(); manifestPath = Poco::Path(FileUtils::Join(moduleTopDir.toString().c_str(), "manifest", NULL)); Poco::File manifestFile(manifestPath); if (manifestFile.exists()) { this->logger->Trace("Reading manifest for module: %s", manifestPath.toString().c_str()); Poco::AutoPtr<Poco::Util::PropertyFileConfiguration> manifest = new Poco::Util::PropertyFileConfiguration(manifestFile.path()); if (manifest->hasProperty("libpath")) { std::string libPath = manifest->getString("libpath"); Poco::StringTokenizer t(libPath, ",", Poco::StringTokenizer::TOK_TRIM); #if defined(OS_WIN32) std::string libPathEnv = "PATH"; #elif defined(OS_OSX) std::string libPathEnv = "DYLD_LIBRARY_PATH"; #elif defined(OS_LINUX) std::string libPathEnv = "LD_LIBRARY_PATH"; #endif std::string newLibPath; if (Environment::has(libPathEnv)) { newLibPath = Environment::get(libPathEnv); } for (size_t i = 0; i < t.count(); i++) { std::string lib = t[i]; newLibPath = FileUtils::Join(moduleTopDir.toString().c_str(), lib.c_str(), NULL) + KR_LIB_SEP + newLibPath; } this->logger->Debug("%s=%s", libPathEnv.c_str(), newLibPath.c_str()); Environment::set(libPathEnv, newLibPath); } } }
void start(Poco::OSP::BundleContext::Ptr pContext) { // We need to obtain the BundleLoader via the Application's OSPSubsystem. Poco::Util::Application& app = Poco::Util::Application::instance(); Poco::OSP::OSPSubsystem& ospSubsystem = app.getSubsystem<Poco::OSP::OSPSubsystem>(); Poco::OSP::BundleLoader& bundleLoader = ospSubsystem.bundleLoader(); Poco::Path sandboxPath(pContext->persistentDirectory(), SandboxRequestHandler::SANDBOX_BUNDLE + ".bndl"); Poco::File sandboxDir(sandboxPath.toString()); if (!sandboxDir.exists()) { pContext->logger().information("Creating sandbox bundle."); sandboxDir.createDirectories(); Poco::Path metaInfPath(sandboxPath, "META-INF"); Poco::File metaInfDir(metaInfPath.toString()); metaInfDir.createDirectory(); Poco::Path manifestPath(metaInfPath, "manifest.mf"); Poco::SharedPtr<std::istream> pManifestIStream = pContext->thisBundle()->getResource("sandbox/manifest.mf"); Poco::FileOutputStream manifestOStream(manifestPath.toString()); Poco::StreamCopier::copyStream(*pManifestIStream, manifestOStream); Poco::Path extensionsPath(sandboxPath, "extensions.xml"); Poco::SharedPtr<std::istream> pExtensionsIStream = pContext->thisBundle()->getResource("sandbox/extensions.xml"); Poco::FileOutputStream extensionsOStream(extensionsPath.toString()); Poco::StreamCopier::copyStream(*pExtensionsIStream, extensionsOStream); Poco::Path scriptPath(sandboxPath, SandboxRequestHandler::SANDBOX_SCRIPT); Poco::SharedPtr<std::istream> pScriptIStream = pContext->thisBundle()->getResource("sandbox/sandbox.js"); Poco::FileOutputStream scriptOStream(scriptPath.toString()); Poco::StreamCopier::copyStream(*pScriptIStream, scriptOStream); } pContext->logger().information("Loading sandbox bundle."); Poco::OSP::Bundle::Ptr pSandboxBundle = bundleLoader.loadBundle(sandboxPath.toString()); pSandboxBundle->resolve(); }