Skip to content

Commit 8084438

Browse files
author
Galeas
committed
1.0.2 hotfix 2
Small bug fix.
1 parent b512b1d commit 8084438

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

CocoaPodUI/CocoaPodUI.m

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,14 @@ - (void) applicationDidFinishLaunching: (NSNotification*) notification
7474
- (void)findGemLocation
7575
{
7676
NSString *location = [[NSUserDefaults standardUserDefaults] valueForKey:kPodGemPathKey];
77+
if ([location length] > 0) {
78+
if (![[NSFileManager defaultManager] fileExistsAtPath:location]) {
79+
// NSLog(@"False Location! ~ \"%@\"", location);
80+
[[NSUserDefaults standardUserDefaults] removeObjectForKey:kPodGemPathKey];
81+
[[NSUserDefaults standardUserDefaults] synchronize];
82+
location = nil;
83+
}
84+
}
7785
// NSLog(@"Saved Location: %@", location);
7886
if ([location length] == 0) {
7987
NSTask *sTask = [[NSTask alloc] init];
@@ -84,7 +92,7 @@ - (void)findGemLocation
8492
NSFileHandle *output = [pipeOut fileHandleForReading];
8593
[sTask launch];
8694
NSData *data = [output readDataToEndOfFile];
87-
NSString *path = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
95+
NSString *path = [[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
8896
if ([[NSFileManager defaultManager] fileExistsAtPath:path]) {
8997
[[NSUserDefaults standardUserDefaults] setValue:path forKeyPath:kPodGemPathKey];
9098
[[NSUserDefaults standardUserDefaults] synchronize];

0 commit comments

Comments
 (0)