PBGitRepository: search for git binary on more paths

This commit is contained in:
Pieter de Bie
2008-06-21 14:05:55 +02:00
parent 42c038ba49
commit 17df4e808a
+11 -3
View File
@@ -28,11 +28,19 @@ static NSString* gitPath;
// No explicit path. Try it with "which"
gitPath = [PBEasyPipe outputForCommand:@"/usr/bin/which" withArgs:[NSArray arrayWithObject:@"git"]];
if (gitPath.length > 0)
return;
if (gitPath.length == 0) {
NSLog(@"Git path not found. Defaulting to /opt/pieter/bin/git");
gitPath = @"/opt/pieter/bin/git";
// Still no path. Let's try some default locations.
NSArray* locations = [NSArray arrayWithObjects:@"/opt/local/bin/git", @"/sw/bin/git", @"/opt/git/bin/git", nil];
for (NSString* location in locations) {
if ([[NSFileManager defaultManager] fileExistsAtPath:location]) {
gitPath = location;
return;
}
}
NSLog(@"Could not find a git binary!");
}
+ (PBGitRepository*) repositoryWithPath:(NSString*) path