Revision: 18218
http://bibdesk.svn.sourceforge.net/bibdesk/?rev=18218&view=rev
Author: hofman
Date: 2011-11-14 16:55:16 +0000 (Mon, 14 Nov 2011)
Log Message:
-----------
move code for open meta tags and rating fully to NSURL category as that's the
only place where we use it.
Modified Paths:
--------------
trunk/bibdesk/NSFileManager_BDSKExtensions.h
trunk/bibdesk/NSFileManager_BDSKExtensions.m
trunk/bibdesk/NSURL_BDSKExtensions.m
Modified: trunk/bibdesk/NSFileManager_BDSKExtensions.h
===================================================================
--- trunk/bibdesk/NSFileManager_BDSKExtensions.h 2011-11-14 13:15:28 UTC
(rev 18217)
+++ trunk/bibdesk/NSFileManager_BDSKExtensions.h 2011-11-14 16:55:16 UTC
(rev 18218)
@@ -104,12 +104,6 @@
- (NSStringEncoding)appleStringEncodingAtPath:(NSString *)path error:(NSError
**)error;
- (BOOL)setAppleStringEncoding:(NSStringEncoding)nsEncoding atPath:(NSString
*)path error:(NSError **)error;
-// support for Open Meta tags and rating
-- (NSArray *)openMetaTagsAtPath:(NSString *)path error:(NSError **)error;
-- (BOOL)setOpenMetaTags:(NSArray *)tags atPath:(NSString *)path error:(NSError
**)error;
-- (NSNumber *)openMetaRatingAtPath:(NSString *)path error:(NSError **)error;
-- (BOOL)setOpenMetaRating:(NSNumber *)rating atPath:(NSString *)path
error:(NSError **)error;
-
// uses createDirectoryAtPath:withIntermediateDirectories:attributes:error:
for the containing directory if necessary
- (BOOL)createPathToFile:(NSString *)path attributes:(NSDictionary
*)attributes;
Modified: trunk/bibdesk/NSFileManager_BDSKExtensions.m
===================================================================
--- trunk/bibdesk/NSFileManager_BDSKExtensions.m 2011-11-14 13:15:28 UTC
(rev 18217)
+++ trunk/bibdesk/NSFileManager_BDSKExtensions.m 2011-11-14 16:55:16 UTC
(rev 18218)
@@ -822,37 +822,4 @@
return nsEncoding;
}
-#pragma mark Open Meta tags
-
-// Support for Open Meta tags and rating
-// These are just definitions for special EA names and the format of their
values
-// They're saved as serialized property list values, which is the same as
SKNExtendedAttributeManager does without splitting and compression
-// See http://code.google.com/p/openmeta/ for some documentation and sample
code
-// Probably we should not write them, because really the com.apple.metadata
domain is private to Apple,
http://ironicsoftware.com/community/comments.php?DiscussionID=632&page=1
-
-- (NSArray *)openMetaTagsAtPath:(NSString *)path error:(NSError **)error {
- return [[SKNExtendedAttributeManager sharedNoSplitManager]
propertyListFromExtendedAttributeNamed:OPEN_META_TAGS_KEY atPath:path
traverseLink:YES error:error];
-}
-
-- (BOOL)setOpenMetaTags:(NSArray *)tags atPath:(NSString *)path error:(NSError
**)error {
- if (tags) {
- [[SKNExtendedAttributeManager sharedNoSplitManager]
setExtendedAttributeNamed:OPEN_META_TAG_TIME_KEY toPropertyListValue:[NSDate
date] atPath:path options:kSKNXattrNoCompress error:error];
- return [[SKNExtendedAttributeManager sharedNoSplitManager]
setExtendedAttributeNamed:OPEN_META_TAGS_KEY toPropertyListValue:tags
atPath:path options:kSKNXattrNoCompress error:error];
- } else {
- [[SKNExtendedAttributeManager sharedNoSplitManager]
removeExtendedAttributeNamed:OPEN_META_TAG_TIME_KEY atPath:path
traverseLink:YES error:error];
- return [[SKNExtendedAttributeManager sharedNoSplitManager]
removeExtendedAttributeNamed:OPEN_META_TAGS_KEY atPath:path traverseLink:YES
error:error];
- }
-}
-
-- (NSNumber *)openMetaRatingAtPath:(NSString *)path error:(NSError **)error {
- return [[SKNExtendedAttributeManager sharedNoSplitManager]
propertyListFromExtendedAttributeNamed:OPEN_META_RATING_KEY atPath:path
traverseLink:YES error:error];
-}
-
-- (BOOL)setOpenMetaRating:(NSNumber *)rating atPath:(NSString *)path
error:(NSError **)error {
- if (rating)
- return [[SKNExtendedAttributeManager sharedNoSplitManager]
setExtendedAttributeNamed:OPEN_META_RATING_KEY toPropertyListValue:rating
atPath:path options:kSKNXattrNoCompress error:error];
- else
- return [[SKNExtendedAttributeManager sharedNoSplitManager]
removeExtendedAttributeNamed:OPEN_META_RATING_KEY atPath:path traverseLink:YES
error:error];
-}
-
@end
Modified: trunk/bibdesk/NSURL_BDSKExtensions.m
===================================================================
--- trunk/bibdesk/NSURL_BDSKExtensions.m 2011-11-14 13:15:28 UTC (rev
18217)
+++ trunk/bibdesk/NSURL_BDSKExtensions.m 2011-11-14 16:55:16 UTC (rev
18218)
@@ -47,6 +47,9 @@
#import "NSAttributedString_BDSKExtensions.h"
#import "BDSKRuntime.h"
+#define OPEN_META_TAGS_KEY @"com.apple.metadata:kMDItemOMUserTags"
+#define OPEN_META_RATING_KEY @"com.apple.metadata:kMDItemStarRating"
+
@implementation NSURL (BDSKExtensions)
+ (NSURL *)fileURLWithAEDesc:(NSAppleEventDescriptor *)desc {
@@ -337,12 +340,18 @@
[FVFinderLabel setFinderLabel:label forURL:self];
}
+// Support for Open Meta tags and rating
+// These are just definitions for special EA names and the format of their
values
+// They're saved as serialized property list values, which is the same as
SKNExtendedAttributeManager does without splitting and compression
+// See http://code.google.com/p/openmeta/ for some documentation and sample
code
+// Probably we should not write them, because really the com.apple.metadata
domain is private to Apple,
http://ironicsoftware.com/community/comments.php?DiscussionID=632&page=1
+
- (NSArray *)openMetaTags{
- return [[NSFileManager defaultManager] openMetaTagsAtPath:[self path]
error:NULL] ?: [NSArray array];
+ return [[SKNExtendedAttributeManager sharedNoSplitManager]
propertyListFromExtendedAttributeNamed:OPEN_META_TAGS_KEY atPath:[self path]
traverseLink:YES error:NULL] ?: [NSArray array];
}
- (double)openMetaRating{
- return [[[NSFileManager defaultManager] openMetaRatingAtPath:[self path]
error:NULL] doubleValue];
+ return [[[SKNExtendedAttributeManager sharedNoSplitManager]
propertyListFromExtendedAttributeNamed:OPEN_META_RATING_KEY atPath:[self path]
traverseLink:YES error:NULL] doubleValue];
}
#pragma mark Templating
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit