Thanks for downloading Dynamsoft Barcode Reader Package!
Your download will start shortly. If your download does not begin, click here to retry.
DSDirectoryFetcher
You are viewing a history document page of DynamsoftUtility v1.0.10.
The DSDirectoryFetcher
class is a utility class that retrieves a list of files from a specified directory based on certain criteria. It inherits from the DSImageSourceAdapter
class.
Definition
Assembly: DynamsoftUtility.framework
- Objective-C
- Swift
NS_SWIFT_NAME(DirectoryFetcher) @interface DSDirectoryFetcher : DSImageSourceAdapter
class DirectoryFetcher : ImageSourceAdapter
Methods
Method | Description |
---|---|
init |
Create an instance of DSDirectoryFetcher. |
setDirectory |
Sets the directory path and filter for the file search. |
init
Create an instance of DSDirectoryFetcher.
- Objective-C
- Swift
- (instancetype)init;
init()
Return Value
An instance of DSDirectoryFetcher
.
Code Snippet
- Objective-C
- Swift
DSDirectoryFetcher *fetcher = [[DSDirectoryFetcher alloc] init];
let fetcher = DirectoryFetcher()
setDirectory
Sets the directory path and filter for the file search.
- Objective-C
- Swift
- (BOOL)setDirectory:(NSString *)directoryPath filter:(nullable NSString *)filter recursive:(BOOL)recursive error:(NSError * _Nullable * _Nullable)error;
func setDirectory(_ directoryPath: String, filter: String?, recursive: Bool) throws
Parameters
directoryPath
: The directory path.
filter
: A string that specifies file extensions. It determines which kinds of files to read. e.g “*.BMP;*.JPG;*.GIF”.
recursive
: Specifies whether to load files recursively.
error
: An NSError
pointer. If an error occurs, it will represent the error information.
Error
Error Code | Value | Description |
---|---|---|
EC_READ_DIRECTORY_FAILED | -10064 | Failed to read the directory. |
Return Value
A BOOL
value that indicates whether the directory is set successfully.
Code Snippet
- Objective-C
- Swift
NSError *error; BOOL success = [fetcher setDirectory:directoryPath filter:nil recursive:YES error:&error];
do { try fetcher.setDirectory(directoryPath, filter: nil, recursive: true) } catch { // Add your code to deal with exceptions. }