mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 21:32:44 +00:00 
			
		
		
		
	 a98ae8f357
			
		
	
	
		a98ae8f357
		
	
	
	
	
		
			
			Our `find` utility makes use of the `dirent::d_type` field for filtering results, which `Core::DirIterator` didn't expose. So, now it does. :^) We now store the name and type of the entry as the "next" value instead of just the name. The type is exposed as a `DirectoryEntry::Type` instead of a `DT_FOO` constant, so that we're not tied to posixy systems, and because proper enums are nice. :^)
		
			
				
	
	
		
			34 lines
		
	
	
	
		
			587 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			34 lines
		
	
	
	
		
			587 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2023, Sam Atkins <atkinssj@serenityos.org>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #pragma once
 | |
| 
 | |
| #include <AK/DeprecatedString.h>
 | |
| 
 | |
| struct dirent;
 | |
| 
 | |
| namespace Core {
 | |
| 
 | |
| struct DirectoryEntry {
 | |
|     enum class Type {
 | |
|         BlockDevice,
 | |
|         CharacterDevice,
 | |
|         Directory,
 | |
|         File,
 | |
|         NamedPipe,
 | |
|         Socket,
 | |
|         SymbolicLink,
 | |
|         Unknown,
 | |
|         Whiteout,
 | |
|     };
 | |
|     Type type;
 | |
|     // FIXME: Once we have a special Path string class, use that.
 | |
|     DeprecatedString name;
 | |
| 
 | |
|     static DirectoryEntry from_dirent(dirent const&);
 | |
| };
 | |
| 
 | |
| }
 |