本文整理汇总了C++中poco::Path::isAbsolute方法的典型用法代码示例。如果您正苦于以下问题:C++ Path::isAbsolute方法的具体用法?C++ Path::isAbsolute怎么用?C++ Path::isAbsolute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类poco::Path
的用法示例。
在下文中一共展示了Path::isAbsolute方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setPath
/**
* Sets the location of the module given an absolute or relative location.
* For relative paths we look for the
* module first in PROG_DIR, then MODULE_DIR, then the
* current directory, and
* finally the system path. Will throw an exception if the module cannot
* be found.
* @param location Absolute or relative path string for module.
*/
void TskModule::setPath(const std::string& location)
{
if (location.empty())
{
throw TskException("TskModule::setPath: location is empty or missing.");
}
Poco::Path tempPath = location;
if (!tempPath.isAbsolute())
{
// If this is a relative path, then see if we can find the
// executable either in PROG_DIR, in MODULE_DIR, in the current directory,
// or on the system path.
std::string pathsToSearch = GetSystemProperty(TskSystemProperties::PROG_DIR);
if (!pathsToSearch.empty())
pathsToSearch += Poco::Path::pathSeparator();
pathsToSearch += GetSystemProperty(TskSystemProperties::MODULE_DIR);
if (!pathsToSearch.empty())
pathsToSearch += Poco::Path::pathSeparator();
pathsToSearch += ".";
if (!Poco::Path::find(pathsToSearch, location, tempPath))
{
// if we didn't find them in the above paths, check on the path.
if (Poco::Environment::has("Path"))
{
std::string systemPath = Poco::Environment::get("Path");
if (!systemPath.empty())
{
Poco::Path::find(systemPath, location, tempPath);
}
}
}
}
// Confirm existence of file at location.
Poco::File moduleFile(tempPath);
if (!moduleFile.exists())
{
std::stringstream msg;
msg << "TskModule::setPath - Module not found: "
<< tempPath.toString().c_str();
throw TskException(msg.str());
}
else {
std::wstringstream msg;
msg << L"TskModule::setPath - Module found at: "
<< tempPath.toString().c_str();
LOGINFO(msg.str());
}
m_modulePath = tempPath.toString();
}