|
@@ -4,6 +4,18 @@
|
|
|
|
|
|
@implementation NSString (Additions)
|
|
|
|
|
|
+- (NSArray *)spaceDelimitedArray {
|
|
|
+ NSCharacterSet *whitespaceAndCharSet = [NSCharacterSet whitespaceAndNewlineCharacterSet];
|
|
|
+ NSScanner *stringScanner = [[NSScanner alloc] initWithString:self];
|
|
|
+ stringScanner.charactersToBeSkipped = whitespaceAndCharSet;
|
|
|
+ NSString *rawValue = nil;
|
|
|
+ NSMutableArray *lineObjects = [NSMutableArray new];
|
|
|
+ while ([stringScanner scanUpToCharactersFromSet:whitespaceAndCharSet intoString:&rawValue]) {
|
|
|
+ [lineObjects addObject:[rawValue trimmedString]];
|
|
|
+ }
|
|
|
+ return lineObjects;
|
|
|
+}
|
|
|
+
|
|
|
- (NSArray *)properPathComponents {
|
|
|
NSMutableArray *newSet = [[self componentsSeparatedByString:@"/"] mutableCopy];
|
|
|
[newSet removeObject:@""];
|
|
@@ -18,14 +30,11 @@
|
|
|
|
|
|
NSArray *comp = [self componentsSeparatedByString:@"-"];
|
|
|
if (comp.count > 1){
|
|
|
-
|
|
|
NSString *first = comp[0];
|
|
|
NSInteger bumpVersion = [[comp lastObject] integerValue]+1;
|
|
|
-
|
|
|
return [NSString stringWithFormat:@"%@-%lu", first, bumpVersion];
|
|
|
-
|
|
|
} else {
|
|
|
- return nil;
|
|
|
+ return [self stringByAppendingString:@"-1"];
|
|
|
}
|
|
|
return nil;
|
|
|
}
|