mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 15:32:46 +00:00 
			
		
		
		
	ImageViewer: Migrate to Directory::for_each_entry()
This commit is contained in:
		
							parent
							
								
									c325a656ec
								
							
						
					
					
						commit
						8f3c77a5a3
					
				
					 1 changed files with 8 additions and 8 deletions
				
			
		|  | @ -12,7 +12,7 @@ | ||||||
| #include <AK/LexicalPath.h> | #include <AK/LexicalPath.h> | ||||||
| #include <AK/StringBuilder.h> | #include <AK/StringBuilder.h> | ||||||
| #include <LibCore/DeprecatedFile.h> | #include <LibCore/DeprecatedFile.h> | ||||||
| #include <LibCore/DirIterator.h> | #include <LibCore/Directory.h> | ||||||
| #include <LibCore/MappedFile.h> | #include <LibCore/MappedFile.h> | ||||||
| #include <LibCore/MimeData.h> | #include <LibCore/MimeData.h> | ||||||
| #include <LibCore/Timer.h> | #include <LibCore/Timer.h> | ||||||
|  | @ -82,13 +82,13 @@ Vector<DeprecatedString> ViewWidget::load_files_from_directory(DeprecatedString | ||||||
|     Vector<DeprecatedString> files_in_directory; |     Vector<DeprecatedString> files_in_directory; | ||||||
| 
 | 
 | ||||||
|     auto current_dir = LexicalPath(path).parent().string(); |     auto current_dir = LexicalPath(path).parent().string(); | ||||||
|     Core::DirIterator iterator(current_dir, Core::DirIterator::Flags::SkipDots); |     // FIXME: Propagate errors
 | ||||||
|     while (iterator.has_next()) { |     (void)Core::Directory::for_each_entry(current_dir, Core::DirIterator::Flags::SkipDots, [&](auto const& entry, auto const& directory) -> ErrorOr<IterationDecision> { | ||||||
|         DeprecatedString file = iterator.next_full_path(); |         auto full_path = LexicalPath::join(directory.path().string(), entry.name).string(); | ||||||
|         if (!Gfx::Bitmap::is_path_a_supported_image_format(file)) |         if (Gfx::Bitmap::is_path_a_supported_image_format(full_path)) | ||||||
|             continue; |             files_in_directory.append(full_path); | ||||||
|         files_in_directory.append(file); |         return IterationDecision::Continue; | ||||||
|     } |     }); | ||||||
|     return files_in_directory; |     return files_in_directory; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Sam Atkins
						Sam Atkins