Skip to content

Commit

Permalink
Exert other options before falling back to PBGitRepository's global s…
Browse files Browse the repository at this point in the history
…tate.
  • Loading branch information
andreberg committed Oct 31, 2009
1 parent 1fed883 commit d5688db
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions PBGitTree.m
Expand Up @@ -11,7 +11,7 @@
#import "NSFileHandleExt.h"
#import "PBEasyPipe.h"
#import "PBEasyFS.h"
//#import "PBGitTreePreviewItem.h"
#import "PBRepositoryDocumentController.h"

#define ICON_SIZE 48.0

Expand All @@ -27,8 +27,15 @@ - (NSString *) previewItemTitle;
@implementation PBGitTree (QLPreviewItemProtocol)

- (NSURL *) previewItemURL {
NSDocument * curDoc = [[PBRepositoryDocumentController sharedDocumentController] currentDocument];
NSString * absPath = self.absolutePath;
if ([absPath isEqualToString:[PBGitRepository basePath]]) {
NSString * basePath = nil;
if (curDoc) {
basePath = [[[curDoc fileURL] path] stringByDeletingLastPathComponent];
} else {
basePath = [PBGitRepository basePath];
}
if ([absPath isEqualToString:basePath]) {
absPath = [absPath stringByAppendingFormat:@"/%@", [self fullPath]];
}
return [NSURL fileURLWithPath:absPath];
Expand Down

0 comments on commit d5688db

Please sign in to comment.