From d5688dbfafdb9205b9b3e880c5f559cb1b4dcfee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Berg?= Date: Sun, 1 Nov 2009 00:26:44 +0100 Subject: [PATCH] Exert other options before falling back to PBGitRepository's global state. --- PBGitTree.m | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/PBGitTree.m b/PBGitTree.m index 5837e92..050a23e 100644 --- a/PBGitTree.m +++ b/PBGitTree.m @@ -11,7 +11,7 @@ #import "NSFileHandleExt.h" #import "PBEasyPipe.h" #import "PBEasyFS.h" -//#import "PBGitTreePreviewItem.h" +#import "PBRepositoryDocumentController.h" #define ICON_SIZE 48.0 @@ -27,8 +27,15 @@ static NSOperationQueue* treeIconQueue = nil; @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];