Don't crash when running dev with no resource path

Previously if the --dev flag was used and no resource was
specified or found in ~/github/atom then the app would
crash trying to add a null resource path to the node paths
list.

Now the bundle resource path is the fallback whenever the
dev resource path cannot be found or does not exist.
This commit is contained in:
Kevin Sawicki
2013-04-29 17:54:31 -07:00
parent 32d23d6303
commit 598cdea22a

View File

@@ -34,10 +34,7 @@
AtomApplication *atomApplication = (AtomApplication *)[AtomApplication sharedApplication];
if (useBundleResourcePath) {
_resourcePath = [[NSBundle bundleForClass:self.class] resourcePath];
}
else {
if (!useBundleResourcePath) {
_resourcePath = [[atomApplication.arguments objectForKey:@"resource-path"] stringByStandardizingPath];
if (!_resourcePath) {
NSString *defaultRepositoryPath = [@"~/github/atom" stringByStandardizingPath];
@@ -48,11 +45,15 @@
_resourcePath = defaultRepositoryPath;
}
else {
_resourcePath = [[NSBundle bundleForClass:self.class] resourcePath];
NSLog(@"Warning: No resource path specified and no directory exists at ~/github/atom");
}
}
}
}
if (!_resourcePath) {
_resourcePath = [[NSBundle bundleForClass:self.class] resourcePath];
}
if ([self isDevMode]) {
[self displayDevIcon];