本文整理汇总了C++中path::make_preferred方法的典型用法代码示例。如果您正苦于以下问题:C++ path::make_preferred方法的具体用法?C++ path::make_preferred怎么用?C++ path::make_preferred使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类path
的用法示例。
在下文中一共展示了path::make_preferred方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: unsubscribe
void file_system_watcher::unsubscribe( path path )
{ path_watchers.erase(path.make_preferred()); }
示例2: ExtractCurrentFile
long ExtractCurrentFile ( path parent, unzFile zip_file )
{
long error = UNZ_OK;
char filename_inzip[PATH_MAX];
unz_file_info64 file_info;
error = unzGetCurrentFileInfo64 ( zip_file, &file_info, filename_inzip, sizeof ( filename_inzip ), NULL, 0, NULL, 0 );
path file = filename_inzip;
file.make_preferred();
parent.make_preferred();
if ( error == UNZ_OK ) {
std::string macos = "__MACOSX";
if ( file.string().compare ( 0, macos.length(), macos ) == 0 ) {
return kNoError;
}
path to_write = parent / file;
create_directories ( to_write.parent_path() );
if ( file.filename().string() == "." ) {
create_directory ( to_write );
} else {
error = unzOpenCurrentFilePassword ( zip_file, NULL );
if ( error == UNZ_OK ) {
char * buffer = new char [ WRITEBUFFERSIZE ];
boost::filesystem::ofstream output_file ( to_write, std::ios_base::binary );
output_file.exceptions ( boost::filesystem::ofstream::badbit | boost::filesystem::ofstream::failbit );
long bytes_read = 0;
do {
bytes_read = unzReadCurrentFile ( zip_file, (void *)buffer, WRITEBUFFERSIZE );
if ( bytes_read > 0 ) {
output_file.write ( buffer, bytes_read );
} else if ( bytes_read < 0 ) {
error = bytes_read;
}
} while ( bytes_read > 0 );
output_file.close();
ChangeFileDate ( to_write, file_info.tmu_date );
delete [] buffer;
}
// don't lose the error
int close_error = unzCloseCurrentFile ( zip_file );
if ( error == UNZ_OK ) {
error = close_error;
}
}
}
return error;
} // ExtractCurrentFile
示例3: subscribe
////////////////////////////////////////////////////////////////////////////////
/// File System Watcher
////////////////////////////////////////////////////////////////////////////////
void file_system_watcher::subscribe( path path, const filter filter_ )
{
path_watchers.insert({
path.make_preferred(),
std::make_shared<path_watcher>(this, path, filter_)});
}