本文整理汇总了C++中PoolStringArray::append方法的典型用法代码示例。如果您正苦于以下问题:C++ PoolStringArray::append方法的具体用法?C++ PoolStringArray::append怎么用?C++ PoolStringArray::append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PoolStringArray
的用法示例。
在下文中一共展示了PoolStringArray::append方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _scan_dir
void FindInFiles::_scan_dir(String path, PoolStringArray &out_folders) {
DirAccess *dir = DirAccess::open(path);
if (dir == NULL) {
print_verbose("Cannot open directory! " + path);
return;
}
dir->list_dir_begin();
for (int i = 0; i < 1000; ++i) {
String file = dir->get_next();
if (file == "")
break;
// Ignore special dirs and hidden dirs (such as .git and .import)
if (file == "." || file == ".." || file.begins_with("."))
continue;
if (dir->current_is_dir())
out_folders.append(file);
else {
String file_ext = file.get_extension();
if (_extension_filter.has(file_ext)) {
_files_to_scan.push_back(path.plus_file(file));
}
}
}
}
示例2: _files_dropped
void ProjectManager::_files_dropped(PoolStringArray p_files, int p_screen) {
Set<String> folders_set;
DirAccess *da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
for (int i = 0; i < p_files.size(); i++) {
String file = p_files[i];
folders_set.insert(da->dir_exists(file) ? file : file.get_base_dir());
}
memdelete(da);
if (folders_set.size()>0) {
PoolStringArray folders;
for (Set<String>::Element *E=folders_set.front();E;E=E->next()) {
folders.append(E->get());
}
bool confirm = true;
if (folders.size()==1) {
DirAccess *dir = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
if (dir->change_dir(folders[0])==OK) {
dir->list_dir_begin();
String file = dir->get_next();
while(confirm && file!=String()) {
if (!dir->current_is_dir() && file.ends_with("godot.cfg")) {
confirm = false;
}
file = dir->get_next();
}
dir->list_dir_end();
}
memdelete(dir);
}
if (confirm) {
multi_scan_ask->get_ok()->disconnect("pressed", this, "_scan_multiple_folders");
multi_scan_ask->get_ok()->connect("pressed", this, "_scan_multiple_folders", varray(folders));
multi_scan_ask->set_text(vformat(TTR("You are about the scan %s folders for existing Godot projects. Do you confirm?"), folders.size()));
multi_scan_ask->popup_centered_minsize();
} else {
_scan_multiple_folders(folders);
}
}
}