Skip to content

Commit

Permalink
Merge pull request #45070 from fmazan/fs-dock-name-sort
Browse files Browse the repository at this point in the history
Fix file name comparison when new file is added to file system
  • Loading branch information
akien-mga authored Jan 14, 2021
2 parents 156d700 + b05ff60 commit 2af5723
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions editor/editor_file_system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1477,20 +1477,21 @@ void EditorFileSystem::update_file(const String &p_file) {
String type = ResourceLoader::get_resource_type(p_file);

if (cpos == -1) {
//the file did not exist, it was added
// The file did not exist, it was added.

late_added_files.insert(p_file); //remember that it was added. This mean it will be scanned and imported on editor restart
late_added_files.insert(p_file); // Remember that it was added. This mean it will be scanned and imported on editor restart.
int idx = 0;
String file_name = p_file.get_file();

for (int i = 0; i < fs->files.size(); i++) {
if (p_file < fs->files[i]->file) {
if (file_name < fs->files[i]->file) {
break;
}
idx++;
}

EditorFileSystemDirectory::FileInfo *fi = memnew(EditorFileSystemDirectory::FileInfo);
fi->file = p_file.get_file();
fi->file = file_name;
fi->import_modified_time = 0;
fi->import_valid = ResourceLoader::is_import_valid(p_file);

Expand Down

0 comments on commit 2af5723

Please sign in to comment.