Skip to content
This repository has been archived by the owner on May 4, 2019. It is now read-only.

Commit

Permalink
Add new methods for getting all files path/url
Browse files Browse the repository at this point in the history
  • Loading branch information
mureev committed Jan 16, 2014
1 parent da2c14a commit 32c98c5
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
18 changes: 18 additions & 0 deletions CMDataStorage/CMDataStorage.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,22 @@
*/
- (NSString *)filePathWithKey:(NSString *)key;

/**
Returns a new array containing the CMDataStorage files paths.
The order of the elements in the array is not defined.
@return The NSArray object with all files url stored in CMDataStorage folder.
*/
- (NSArray*)allKeysURLs;

/**
Returns a new array containing the CMDataStorage files paths.
The order of the elements in the array is not defined.
@return The NSArray object with all files paths stored in
*/
- (NSArray*)allKeysPaths;

@end
10 changes: 10 additions & 0 deletions CMDataStorage/CMDataStorage.m
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,16 @@ - (NSString *)filePathWithKey:(NSString *)key {
return [[self fileURLWithKey:key] path];
}

- (NSArray*)allKeysURLs {
NSArray *dirContents = [get_file_manager() contentsOfDirectoryAtURL:self.cachePath includingPropertiesForKeys:nil options:0 error:nil];
return dirContents;
}

- (NSArray*)allKeysPaths {
NSArray *dirContents = [get_file_manager() contentsOfDirectoryAtPath:[self.cachePath path] error:nil];
return dirContents;
}


#pragma mark - Private

Expand Down

0 comments on commit 32c98c5

Please sign in to comment.