void setPathsOnContext( const ZorbaCMDProperties& aProperties, StaticContext_t& aStaticCtx) { std::vector<String> lPath; std::string lPathStr; // Compute the current working directory to append to all paths. filesystem_path lCWD; // setModulePaths() *overwrites* the URI path and lib path, so there's no // sense in calling both. So if --module-path exists, just use it. aProperties.getModulePath(lPathStr); if (lPathStr.length() > 0) { tokenizePath(lPathStr, lPath); lPath.push_back(lCWD.get_path()); aStaticCtx->setModulePaths(lPath); } else { // Compute and set URI path aProperties.getURIPath(lPathStr); tokenizePath(lPathStr, lPath); lPath.push_back(lCWD.get_path()); aStaticCtx->setURIPath(lPath); lPath.clear(); // Compute and set lib path aProperties.getLibPath(lPathStr); tokenizePath(lPathStr, lPath); lPath.push_back(lCWD.get_path()); aStaticCtx->setLibPath(lPath); } }
Path::Path(const std::string &path): path_(path) { assert( e_.size()==0u ); tokenizePath(); // not enought elements? if( e_.size()<2u ) throw ExceptionInvalidPath(SYSTEM_SAVE_LOCATION, path_, path_, "path too short"); // NOTE: since meta-alerts can be processed as well as alerts there is not such thing as too long // path, since there can be a sequence like metaalert.children.0.metalert...(and so on) // many times. thus only minimal length will be checked. assert(path_==path); // sanity check }