Revision: 12195 http://bibdesk.svn.sourceforge.net/bibdesk/?rev=12195&view=rev Author: hofman Date: 2008-01-02 09:31:23 -0800 (Wed, 02 Jan 2008)
Log Message: ----------- Remove warning and local variable. Rename confused argument. Search fileID first when resolving aliases, because this does not follow symlinks to their targets, unlike what searching path first does. Modified Paths: -------------- trunk/bibdesk/BDSKLinkedFile.m Modified: trunk/bibdesk/BDSKLinkedFile.m =================================================================== --- trunk/bibdesk/BDSKLinkedFile.m 2008-01-02 17:15:11 UTC (rev 12194) +++ trunk/bibdesk/BDSKLinkedFile.m 2008-01-02 17:31:23 UTC (rev 12195) @@ -469,7 +469,8 @@ } if (hasRef == false && alias != NULL) { - hasRef = noErr == FSMatchAliasNoUI(hasBaseRef ? &baseRef : NULL, kARMNoUI | kARMSearch | kARMSearchRelFirst, alias, &aliasCount, &aRef, &shouldUpdate, NULL, NULL); + // it would be preferable to search the (relative) path before the fileID, but than links to symlinks will always be resolved to the target + hasRef = noErr == FSMatchAliasNoUI(hasBaseRef ? &baseRef : NULL, kARMNoUI | kARMSearch | kARMSearchRelFirst | kARMTryFileIDFirst, alias, &aliasCount, &aRef, &shouldUpdate, NULL, NULL); shouldUpdate = shouldUpdate && hasBaseRef && hasRef; } @@ -519,23 +520,21 @@ return [path autorelease]; } -- (NSData *)aliasDataRelativeToPath:(NSString *)newBasePath; +- (NSData *)aliasDataRelativeToPath:(NSString *)basePath; { // make sure the fileRef is valid [self path]; FSRef *fsRef = (FSRef *)[self fileRef]; FSRef baseRef; - NSString *basePath; AliasHandle anAlias = NULL; CFDataRef data = NULL; if (fsRef) { - BOOL hasBaseRef = (newBasePath && noErr == BDSKPathToFSRef((CFStringRef)newBasePath, &baseRef)); + BOOL hasBaseRef = (basePath && noErr == BDSKPathToFSRef((CFStringRef)basePath, &baseRef)); anAlias = BDSKFSRefToAliasHandle(fsRef, hasBaseRef ? &baseRef : NULL); - } else if (relativePath && newBasePath) { -#warning uninitialized variable - anAlias = BDSKPathToAliasHandle((CFStringRef)[basePath stringByAppendingPathComponent:relativePath], (CFStringRef)newBasePath); + } else if (relativePath && basePath) { + anAlias = BDSKPathToAliasHandle((CFStringRef)[basePath stringByAppendingPathComponent:relativePath], (CFStringRef)basePath); } if (anAlias != NULL) { data = BDSKAliasHandleToData(anAlias); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Bibdesk-commit mailing list Bibdesk-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bibdesk-commit