本文整理汇总了C++中Path::GetDir方法的典型用法代码示例。如果您正苦于以下问题:C++ Path::GetDir方法的具体用法?C++ Path::GetDir怎么用?C++ Path::GetDir使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Path
的用法示例。
在下文中一共展示了Path::GetDir方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: time
void CatalogImages::Impl::PrepareHeader(std::vector<uint8>& header, Path path,
const String& title, const String& description,
CatalogHeader::DirPtr dir, bool folder_scan)
{
header_.version_ = 1;
header_.img_count_ = 0;
FILETIME ft;
::GetSystemTimeAsFileTime(&ft);
header_.creation_time_ = ft; // catalog creation time (UTC)
header_.scan_types_ = scan_types_; // what types were scanned (FT_*)
header_.title_ = String2WStr(title);
header_.description_ = String2WStr(description);
String root= path.GetRoot();
int drv_type= 0;
for (;;)
{
drv_type = ::GetDriveType(path.c_str());
if (drv_type != DRIVE_NO_ROOT_DIR)
break;
if (path.length() > root.length())
path = path.GetDir();
else
break;
}
header_.drive_type_ = drv_type;
header_.drive_or_folder_ = folder_scan;
TCHAR volume[MAX_PATH]= { 0 };
DWORD serial_no= 0;
DWORD dummy= 0;
DWORD vol_flags= 0;
if (::GetVolumeInformation(path.c_str(), volume, MAX_PATH, &serial_no, &dummy, &vol_flags, 0, 0) == 0)
{
path += _T("\\");
if (::GetVolumeInformation(path.c_str(), volume, MAX_PATH, &serial_no, &dummy, &vol_flags, 0, 0) == 0)
::GetVolumeInformation(root.c_str(), volume, MAX_PATH, &serial_no, &dummy, &vol_flags, 0, 0);
}
header_.volume_name_ = String2WStr(volume);
header_.volume_serial_no_ = serial_no;
header_.volume_flags_ = vol_flags;
header_.directory_ = dir;
header_.Write(header);
}
示例2: Path
void CatalogImages::Impl::EnteringDir(const Path& path, int id)
{
//TRACE(L"===ENTERING: (%d) %s\n", id, path.c_str());
bool root= id == 1;
// for a root use absolute path, for remaining folders use relative paths
String name= root ? path.GetDir() : Path(path.GetDir()).GetFileNameAndExt();
DWORD attribs= ::GetFileAttributes(path.GetDir().c_str());
CatalogHeader::DirPtr dir= new CatalogHeader::Dir(String2WStr(name).c_str(), id, attribs);
if (cur_dir_)
{
dir_stack_.push_back(cur_dir_);
cur_dir_->subdirs_.push_back(dir);
}
cur_dir_ = dir;
if (root)
root_dir_ = cur_dir_;
}