本文整理汇总了C++中path_t::directory方法的典型用法代码示例。如果您正苦于以下问题:C++ path_t::directory方法的具体用法?C++ path_t::directory怎么用?C++ path_t::directory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类path_t
的用法示例。
在下文中一共展示了path_t::directory方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: make_directory
virtual int make_directory(entry_t& entry, const path_t& path) {
const char_t* chars = 0;
size_t length = 0;
int err = 1;
if ((chars = path.directory().chars(length)) && (0 < length)) {
const char_t* dchars = chars;
size_t dlength = length;
sub_directories_t sub_directories;
EV_LOG_MESSAGE_INFO("make directory \"" << chars << "\"...");
for (bool exists = false; !exists; ) {
string_t directory(dchars, dlength);
EV_LOG_MESSAGE_INFO("directory \"" << directory.chars() << "\" exists?...");
if (!(exists = entry.exists(directory.chars()))) {
sub_directory_t sub_directory(dchars, dlength);
EV_LOG_MESSAGE_INFO("...directory \"" << directory.chars() << "\" does not exist");
sub_directories.push_front(sub_directory);
if ((dchars = parent_directory(dchars, dlength, path))) {
continue;
}
} else {
EV_LOG_MESSAGE_INFO("...directory \"" << directory.chars() << "\" exists");
}
break;
}
err = make_directories(sub_directories, entry, path);
}
return err;
}
示例2: target_path
virtual int copy_file_to_hash
(const entry_t& source, const path_t& target, hash_t& hash) {
entry_t& entry = target_entry_;
string_t target_path(target.chars());
const char_t* chars = 0;
int err = 1;
if ((append_hash_name_to_target_path_) && (chars = hash.name())) {
target_path.append(&target.extension_separator(), 1);
target_path.append(hash_name_prefix_);
target_path.append(chars);
target_path.append(hash_name_suffix_);
}
if ((entry.exists(chars = target_path.chars()))) {
if ((write_overwrite != write_) && (write_append != write_)) {
errf("target file \"%s\" already exists\n", chars);
} else {
fs::entry_type type = fs::entry_type_none;
switch (type = entry.type()) {
case fs::entry_type_file:
err = copy_file_to_file_hash(source, entry, hash);
break;
default:
break;
}
}
} else {
if (!(err = make_directory(entry, target))) {
entry.set_path(chars);
err = copy_file_to_file_hash(source, entry, hash);
} else {
errf("failed to make directory \"%s\"\n", target.directory().chars());
}
}
if (!(err) && (!(to_same != to_) || !(target_modified_))) {
if ((entry.set_times_to_set(source))) {
if ((entry.set_times_set())) {
} else {
}
}
}
return err;
}
示例3: copy_file
virtual int copy_file(const entry_t& source, const path_t& target) {
entry_t& entry = target_entry_;
const char_t* chars = 0;
int err = 1;
if ((entry.exists(chars = target.chars()))) {
if ((write_overwrite != write_) && (write_append != write_)) {
errf("target file \"%s\" already exists\n", chars);
} else {
fs::entry_type type = fs::entry_type_none;
switch (type = entry.type()) {
case fs::entry_type_file:
err = copy_file_to_file(source, entry);
break;
default:
break;
}
}
} else {
if (!(err = make_directory(entry, target))) {
entry.set_path(chars);
err = copy_file_to_file(source, entry);
} else {
errf("failed to make directory \"%s\"\n", target.directory().chars());
}
}
if (!(err) && (!(to_same != to_) || !(target_modified_))) {
if ((entry.set_times_to_set(source))) {
if ((entry.set_times_set())) {
} else {
}
}
}
return err;
}