summaryrefslogtreecommitdiff
path: root/editor/find_in_files.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/find_in_files.cpp')
-rw-r--r--editor/find_in_files.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/editor/find_in_files.cpp b/editor/find_in_files.cpp
index e1ab5c62a7..752e49a932 100644
--- a/editor/find_in_files.cpp
+++ b/editor/find_in_files.cpp
@@ -221,8 +221,8 @@ float FindInFiles::get_progress() const {
void FindInFiles::_scan_dir(String path, PoolStringArray &out_folders) {
- DirAccess *dir = DirAccess::open(path);
- if (dir == NULL) {
+ DirAccessRef dir = DirAccess::open(path);
+ if (!dir) {
print_verbose("Cannot open directory! " + path);
return;
}
@@ -253,8 +253,8 @@ void FindInFiles::_scan_dir(String path, PoolStringArray &out_folders) {
void FindInFiles::_scan_file(String fpath) {
- FileAccess *f = FileAccess::open(fpath, FileAccess::READ);
- if (f == NULL) {
+ FileAccessRef f = FileAccess::open(fpath, FileAccess::READ);
+ if (!f) {
print_verbose(String("Cannot open file ") + fpath);
return;
}
@@ -524,6 +524,7 @@ FindInFilesPanel::FindInFilesPanel() {
_progress_bar = memnew(ProgressBar);
_progress_bar->set_h_size_flags(SIZE_EXPAND_FILL);
+ _progress_bar->set_v_size_flags(SIZE_SHRINK_CENTER);
hbc->add_child(_progress_bar);
set_progress_visible(false);
@@ -546,6 +547,7 @@ FindInFilesPanel::FindInFilesPanel() {
_results_display->connect("item_edited", this, "_on_item_edited");
_results_display->set_hide_root(true);
_results_display->set_select_mode(Tree::SELECT_ROW);
+ _results_display->set_allow_rmb_select(true);
_results_display->create_item(); // Root
vbc->add_child(_results_display);
@@ -827,7 +829,7 @@ void FindInFilesPanel::apply_replaces_in_file(String fpath, const Vector<Result>
// however that means either losing changes or losing replaces.
FileAccess *f = FileAccess::open(fpath, FileAccess::READ);
- ERR_FAIL_COND(f == NULL);
+ ERR_FAIL_COND_MSG(f == NULL, "Cannot open file from path '" + fpath + "'.");
String buffer;
int current_line = 1;
@@ -874,7 +876,7 @@ void FindInFilesPanel::apply_replaces_in_file(String fpath, const Vector<Result>
// Now the modified contents are in the buffer, rewrite the file with our changes
Error err = f->reopen(fpath, FileAccess::WRITE);
- ERR_FAIL_COND(err != OK);
+ ERR_FAIL_COND_MSG(err != OK, "Cannot create file in path '" + fpath + "'.");
f->store_string(buffer);