diff options
| author | Filip <filip@mazan.in> | 2021-01-10 12:26:44 +0100 | 
|---|---|---|
| committer | Filip <filip@mazan.in> | 2021-01-10 12:28:15 +0100 | 
| commit | b05ff60f6ec6e393e59f9188035b7f4b2e5a8566 (patch) | |
| tree | e9696e470cb07e232f9b0d4e3514e2bbc1d32c25 | |
| parent | 98ccaa1bad97bdb83b2afd6a4df6f7a392745592 (diff) | |
Fix file name comparison when new file is added to file system
| -rw-r--r-- | editor/editor_file_system.cpp | 9 | 
1 files changed, 5 insertions, 4 deletions
diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp index 208f678947..76814ea378 100644 --- a/editor/editor_file_system.cpp +++ b/editor/editor_file_system.cpp @@ -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);  |