Bug fixes for playlist file loading.
parent
d82fdcbf62
commit
16f0c942bc
|
@ -26,13 +26,22 @@
|
||||||
|
|
||||||
NSMutableString *unixPath = [path mutableCopy];
|
NSMutableString *unixPath = [path mutableCopy];
|
||||||
|
|
||||||
|
//Get the fragment
|
||||||
NSString *fragment = @"";
|
NSString *fragment = @"";
|
||||||
NSRange fragmentRange = [path rangeOfCharacterFromSet:[NSCharacterSet characterSetWithCharactersInString:@"#0123456789"] options:(NSAnchoredSearch | NSBackwardsSearch)];
|
NSScanner *scanner = [NSScanner scannerWithString:unixPath];
|
||||||
if (fragmentRange.location != NSNotFound)
|
NSCharacterSet *characterSet = [NSCharacterSet characterSetWithCharactersInString:@"#1234567890"];
|
||||||
|
while (![scanner isAtEnd]) {
|
||||||
|
NSString *possibleFragment;
|
||||||
|
[scanner scanUpToString:@"#" intoString:nil];
|
||||||
|
|
||||||
|
if ([scanner scanCharactersFromSet:characterSet intoString:&possibleFragment] && [scanner isAtEnd])
|
||||||
{
|
{
|
||||||
fragment = [unixPath substringWithRange:fragmentRange];
|
fragment = possibleFragment;
|
||||||
[unixPath deleteCharactersInRange:fragmentRange];
|
[unixPath deleteCharactersInRange:NSMakeRange([scanner scanLocation] - [possibleFragment length], [possibleFragment length])];
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
NSLog(@"Fragment: %@", fragment);
|
||||||
|
|
||||||
if (![unixPath hasPrefix:@"/"]) {
|
if (![unixPath hasPrefix:@"/"]) {
|
||||||
//Only relative paths would have windows backslashes.
|
//Only relative paths would have windows backslashes.
|
||||||
|
@ -49,6 +58,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- (void)parseFile:(NSString *)filename
|
- (void)parseFile:(NSString *)filename
|
||||||
{
|
{
|
||||||
NSError *error = nil;
|
NSError *error = nil;
|
||||||
|
|
|
@ -31,13 +31,22 @@
|
||||||
|
|
||||||
NSMutableString *unixPath = [path mutableCopy];
|
NSMutableString *unixPath = [path mutableCopy];
|
||||||
|
|
||||||
|
//Get the fragment
|
||||||
NSString *fragment = @"";
|
NSString *fragment = @"";
|
||||||
NSRange fragmentRange = [path rangeOfCharacterFromSet:[NSCharacterSet characterSetWithCharactersInString:@"#0123456789"] options:(NSAnchoredSearch | NSBackwardsSearch)];
|
NSScanner *scanner = [NSScanner scannerWithString:unixPath];
|
||||||
if (fragmentRange.location != NSNotFound)
|
NSCharacterSet *characterSet = [NSCharacterSet characterSetWithCharactersInString:@"#1234567890"];
|
||||||
|
while (![scanner isAtEnd]) {
|
||||||
|
NSString *possibleFragment;
|
||||||
|
[scanner scanUpToString:@"#" intoString:nil];
|
||||||
|
|
||||||
|
if ([scanner scanCharactersFromSet:characterSet intoString:&possibleFragment] && [scanner isAtEnd])
|
||||||
{
|
{
|
||||||
fragment = [unixPath substringWithRange:fragmentRange];
|
fragment = possibleFragment;
|
||||||
[unixPath deleteCharactersInRange:fragmentRange];
|
[unixPath deleteCharactersInRange:NSMakeRange([scanner scanLocation] - [possibleFragment length], [possibleFragment length])];
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
NSLog(@"Fragment: %@", fragment);
|
||||||
|
|
||||||
if (![unixPath hasPrefix:@"/"]) {
|
if (![unixPath hasPrefix:@"/"]) {
|
||||||
//Only relative paths would have windows backslashes.
|
//Only relative paths would have windows backslashes.
|
||||||
|
|
|
@ -31,13 +31,22 @@
|
||||||
|
|
||||||
NSMutableString *unixPath = [path mutableCopy];
|
NSMutableString *unixPath = [path mutableCopy];
|
||||||
|
|
||||||
|
//Get the fragment
|
||||||
NSString *fragment = @"";
|
NSString *fragment = @"";
|
||||||
NSRange fragmentRange = [path rangeOfCharacterFromSet:[NSCharacterSet characterSetWithCharactersInString:@"#0123456789"] options:(NSAnchoredSearch | NSBackwardsSearch)];
|
NSScanner *scanner = [NSScanner scannerWithString:unixPath];
|
||||||
if (fragmentRange.location != NSNotFound)
|
NSCharacterSet *characterSet = [NSCharacterSet characterSetWithCharactersInString:@"#1234567890"];
|
||||||
|
while (![scanner isAtEnd]) {
|
||||||
|
NSString *possibleFragment;
|
||||||
|
[scanner scanUpToString:@"#" intoString:nil];
|
||||||
|
|
||||||
|
if ([scanner scanCharactersFromSet:characterSet intoString:&possibleFragment] && [scanner isAtEnd])
|
||||||
{
|
{
|
||||||
fragment = [unixPath substringWithRange:fragmentRange];
|
fragment = possibleFragment;
|
||||||
[unixPath deleteCharactersInRange:fragmentRange];
|
[unixPath deleteCharactersInRange:NSMakeRange([scanner scanLocation] - [possibleFragment length], [possibleFragment length])];
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
NSLog(@"Fragment: %@", fragment);
|
||||||
|
|
||||||
if (![unixPath hasPrefix:@"/"]) {
|
if (![unixPath hasPrefix:@"/"]) {
|
||||||
//Only relative paths would have windows backslashes.
|
//Only relative paths would have windows backslashes.
|
||||||
|
|
Loading…
Reference in New Issue