Bug Fix: Chase the dict keys with periods problem
This was a more prolific problem than I thought. Hopefully that's the last that I need to fix. Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This commit is contained in:
parent
d4fec5c70e
commit
d41e34913a
8 changed files with 29 additions and 18 deletions
|
@ -349,6 +349,10 @@ static inline void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_bloc
|
|||
}
|
||||
}
|
||||
|
||||
+ (NSString *)keyForPath:(NSString *)path {
|
||||
return [path stringByReplacingOccurrencesOfString:@"." withString:@"%2E"];
|
||||
}
|
||||
|
||||
- (NSArray *)insertURLs:(NSArray *)urls atIndex:(NSInteger)index sort:(BOOL)sort {
|
||||
__block NSMutableSet *uniqueURLs = [NSMutableSet set];
|
||||
|
||||
|
@ -396,7 +400,7 @@ static inline void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_bloc
|
|||
[[SandboxBroker sharedSandboxBroker] addFolderIfMissing:url];
|
||||
NSArray *pathURLs = [self fileURLsAtPath:[url path]];
|
||||
for(NSURL *url in pathURLs) {
|
||||
[expandedURLs setValue:url forKey:[url absoluteString]];
|
||||
[expandedURLs setValue:url forKey:[PlaylistLoader keyForPath:[url absoluteString]]];
|
||||
}
|
||||
} else if(addOtherFilesInFolder) {
|
||||
NSURL *folderUrl = [url URLByDeletingLastPathComponent];
|
||||
|
@ -404,18 +408,18 @@ static inline void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_bloc
|
|||
[[SandboxBroker sharedSandboxBroker] requestFolderForFile:url];
|
||||
NSArray *pathURLs = [self fileURLsAtPath:[folderUrl path]];
|
||||
for(NSURL *url in pathURLs) {
|
||||
[expandedURLs setValue:url forKey:[url absoluteString]];
|
||||
[expandedURLs setValue:url forKey:[PlaylistLoader keyForPath:[url absoluteString]]];
|
||||
}
|
||||
[folderURLs addObject:folderUrl];
|
||||
}
|
||||
} else {
|
||||
[[SandboxBroker sharedSandboxBroker] addFileIfMissing:url];
|
||||
[expandedURLs setValue:url forKey:[url absoluteString]];
|
||||
[expandedURLs setValue:url forKey:[PlaylistLoader keyForPath:[url absoluteString]]];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Non-file URL..
|
||||
[expandedURLs setValue:url forKey:[url absoluteString]];
|
||||
[expandedURLs setValue:url forKey:[PlaylistLoader keyForPath:[url absoluteString]]];
|
||||
}
|
||||
|
||||
[pathTask finish];
|
||||
|
|
|
@ -586,10 +586,11 @@ static uint8_t reverse_bits[0x100];
|
|||
}
|
||||
|
||||
static void setDictionary(NSMutableDictionary *dict, NSString *tag, NSString *value) {
|
||||
NSMutableArray *array = [dict valueForKey:tag];
|
||||
NSString *realKey = [tag stringByReplacingOccurrencesOfString:@"." withString:@"․"];
|
||||
NSMutableArray *array = [dict valueForKey:realKey];
|
||||
if(!array) {
|
||||
array = [[NSMutableArray alloc] init];
|
||||
[dict setObject:array forKey:tag];
|
||||
[dict setObject:array forKey:realKey];
|
||||
}
|
||||
[array addObject:value];
|
||||
}
|
||||
|
|
|
@ -181,10 +181,11 @@ FLAC__StreamDecoderWriteStatus WriteCallback(const FLAC__StreamDecoder *decoder,
|
|||
}
|
||||
|
||||
static void setDictionary(NSMutableDictionary *dict, NSString *tag, NSString *value) {
|
||||
NSMutableArray *array = [dict valueForKey:tag];
|
||||
NSString *realKey = [tag stringByReplacingOccurrencesOfString:@"." withString:@"․"];
|
||||
NSMutableArray *array = [dict valueForKey:realKey];
|
||||
if(!array) {
|
||||
array = [[NSMutableArray alloc] init];
|
||||
[dict setObject:array forKey:tag];
|
||||
[dict setObject:array forKey:realKey];
|
||||
}
|
||||
[array addObject:value];
|
||||
}
|
||||
|
|
|
@ -222,10 +222,11 @@ static int parse_time_crap(NSString *value) {
|
|||
}
|
||||
|
||||
static void setDictionary(NSMutableDictionary *dict, NSString *tag, NSString *value) {
|
||||
NSMutableArray *array = [dict valueForKey:tag];
|
||||
NSString *realKey = [tag stringByReplacingOccurrencesOfString:@"." withString:@"․"];
|
||||
NSMutableArray *array = [dict valueForKey:realKey];
|
||||
if(!array) {
|
||||
array = [[NSMutableArray alloc] init];
|
||||
[dict setObject:array forKey:tag];
|
||||
[dict setObject:array forKey:realKey];
|
||||
}
|
||||
if([array count]) {
|
||||
NSString *existing = array[0];
|
||||
|
|
|
@ -29,10 +29,11 @@
|
|||
}
|
||||
|
||||
static void setDictionary(NSMutableDictionary *dict, NSString *tag, NSString *value) {
|
||||
NSMutableArray *array = [dict valueForKey:tag];
|
||||
NSString *realKey = [tag stringByReplacingOccurrencesOfString:@"." withString:@"․"];
|
||||
NSMutableArray *array = [dict valueForKey:realKey];
|
||||
if(!array) {
|
||||
array = [[NSMutableArray alloc] init];
|
||||
[dict setObject:array forKey:tag];
|
||||
[dict setObject:array forKey:realKey];
|
||||
}
|
||||
[array addObject:value];
|
||||
}
|
||||
|
|
|
@ -28,10 +28,11 @@
|
|||
}
|
||||
|
||||
static void setDictionary(NSMutableDictionary *dict, NSString *tag, NSString *value) {
|
||||
NSMutableArray *array = [dict valueForKey:tag];
|
||||
NSString *realKey = [tag stringByReplacingOccurrencesOfString:@"." withString:@"․"];
|
||||
NSMutableArray *array = [dict valueForKey:realKey];
|
||||
if(!array) {
|
||||
array = [[NSMutableArray alloc] init];
|
||||
[dict setObject:array forKey:tag];
|
||||
[dict setObject:array forKey:realKey];
|
||||
}
|
||||
[array addObject:value];
|
||||
}
|
||||
|
|
|
@ -137,10 +137,11 @@ opus_int64 sourceTell(void *_stream) {
|
|||
}
|
||||
|
||||
static void setDictionary(NSMutableDictionary *dict, NSString *tag, NSString *value) {
|
||||
NSMutableArray *array = [dict valueForKey:tag];
|
||||
NSString *realKey = [tag stringByReplacingOccurrencesOfString:@"." withString:@"․"];
|
||||
NSMutableArray *array = [dict valueForKey:realKey];
|
||||
if(!array) {
|
||||
array = [[NSMutableArray alloc] init];
|
||||
[dict setObject:array forKey:tag];
|
||||
[dict setObject:array forKey:realKey];
|
||||
}
|
||||
[array addObject:value];
|
||||
}
|
||||
|
|
|
@ -117,10 +117,11 @@ long sourceTell(void *datasource) {
|
|||
}
|
||||
|
||||
static void setDictionary(NSMutableDictionary *dict, NSString *tag, NSString *value) {
|
||||
NSMutableArray *array = [dict valueForKey:tag];
|
||||
NSString *realKey = [tag stringByReplacingOccurrencesOfString:@"." withString:@"․"];
|
||||
NSMutableArray *array = [dict valueForKey:realKey];
|
||||
if(!array) {
|
||||
array = [[NSMutableArray alloc] init];
|
||||
[dict setObject:array forKey:tag];
|
||||
[dict setObject:array forKey:realKey];
|
||||
}
|
||||
[array addObject:value];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue