mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 06:42:43 +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/StringBuilder.h> | ||||
| #include <LibCore/DeprecatedFile.h> | ||||
| #include <LibCore/DirIterator.h> | ||||
| #include <LibCore/Directory.h> | ||||
| #include <LibCore/MappedFile.h> | ||||
| #include <LibCore/MimeData.h> | ||||
| #include <LibCore/Timer.h> | ||||
|  | @ -82,13 +82,13 @@ Vector<DeprecatedString> ViewWidget::load_files_from_directory(DeprecatedString | |||
|     Vector<DeprecatedString> files_in_directory; | ||||
| 
 | ||||
|     auto current_dir = LexicalPath(path).parent().string(); | ||||
|     Core::DirIterator iterator(current_dir, Core::DirIterator::Flags::SkipDots); | ||||
|     while (iterator.has_next()) { | ||||
|         DeprecatedString file = iterator.next_full_path(); | ||||
|         if (!Gfx::Bitmap::is_path_a_supported_image_format(file)) | ||||
|             continue; | ||||
|         files_in_directory.append(file); | ||||
|     } | ||||
|     // FIXME: Propagate errors
 | ||||
|     (void)Core::Directory::for_each_entry(current_dir, Core::DirIterator::Flags::SkipDots, [&](auto const& entry, auto const& directory) -> ErrorOr<IterationDecision> { | ||||
|         auto full_path = LexicalPath::join(directory.path().string(), entry.name).string(); | ||||
|         if (Gfx::Bitmap::is_path_a_supported_image_format(full_path)) | ||||
|             files_in_directory.append(full_path); | ||||
|         return IterationDecision::Continue; | ||||
|     }); | ||||
|     return files_in_directory; | ||||
| } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Sam Atkins
						Sam Atkins