[28349] trunk/dports/fuse/spotlightfs

source_changes at macosforge.org source_changes at macosforge.org
Tue Aug 28 17:20:57 PDT 2007


Revision: 28349
          http://trac.macosforge.org/projects/macports/changeset/28349
Author:   eridius at macports.org
Date:     2007-08-28 17:20:57 -0700 (Tue, 28 Aug 2007)

Log Message:
-----------
Pull changes from upstream trunk to make SpotlightFS actually usable

Modified Paths:
--------------
    trunk/dports/fuse/spotlightfs/Portfile

Added Paths:
-----------
    trunk/dports/fuse/spotlightfs/files/
    trunk/dports/fuse/spotlightfs/files/patch-writable-dirs

Modified: trunk/dports/fuse/spotlightfs/Portfile
===================================================================
--- trunk/dports/fuse/spotlightfs/Portfile	2007-08-28 22:41:03 UTC (rev 28348)
+++ trunk/dports/fuse/spotlightfs/Portfile	2007-08-29 00:20:57 UTC (rev 28349)
@@ -5,7 +5,7 @@
 
 name                spotlightfs
 version             0.1.0
-revision            1
+revision            2
 categories          fuse
 platforms           macosx
 maintainers         eridius at macports.org
@@ -27,6 +27,9 @@
                     FUSEObjC-0.4.0.tar.bz2 md5 9ac70a7faf748e04e4e0bf0c8856b7c5 \
                                            sha1 99752396411e3b44728436d15d6cb76bd1966e1f
 
+# this patch needs to be removed next time there's a SpotlightFS release
+patchfiles          patch-writable-dirs
+
 use_bzip2           yes
 
 livecheck.distname  SpotlightFS-(.*).dmg

Added: trunk/dports/fuse/spotlightfs/files/patch-writable-dirs
===================================================================
--- trunk/dports/fuse/spotlightfs/files/patch-writable-dirs	                        (rev 0)
+++ trunk/dports/fuse/spotlightfs/files/patch-writable-dirs	2007-08-29 00:20:57 UTC (rev 28349)
@@ -0,0 +1,76 @@
+Index: Source/SpotlightFS.m
+===================================================================
+--- Source/SpotlightFS.m	(.../tags/macfuse-0.4.0/filesystems-objc/SpotlightFS)	(revision 445)
++++ Source/SpotlightFS.m	(.../trunk/filesystems-objc/SpotlightFS)	(revision 445)
+@@ -129,6 +129,25 @@
+   return userCreatedFolders;
+ }
+ 
++// -isUserCreatedFolder:
++//
++// Returns YES if the specified folder is a user created folder. Also try
++// prepending a leading slash to the user created folders, incase |path| starts
++// with a slash.
++//
++- (BOOL)isUserCreatedFolder:(NSString *)path {
++  NSArray *folders = [self userCreatedFolders];
++  NSString *folder = nil;
++  NSEnumerator *folderEnumerator = [folders objectEnumerator];
++  while ((folder = [folderEnumerator nextObject])) {
++    if ([folder isEqualToString:path])
++      return YES;
++    if ([[@"/" stringByAppendingPathComponent:folder] isEqualToString:path])
++      return YES;
++  }
++  return NO;
++}
++
+ // -setUserCreatedFolders:
+ //
+ // Sets the folder names to use for the top-level user-created folders.
+@@ -341,20 +360,27 @@
+   return NO;
+ }
+ 
++// By default, directories are not writeable, with the notable exceptions below:
++// - Slash is writable
++// - User created directories in slash are writable
+ - (NSDictionary *)fileAttributesAtPath:(NSString *)path {
+   if (!path)
+     return nil;
+   
+   NSMutableDictionary *attr = nil;
++  int mode = 0500;
+   
+   NSString *pathdir = [path stringByDeletingLastPathComponent];
+   NSString *smarter = [@"/" stringByAppendingString:kSmarterFolder];
+   
+-  if ([pathdir isEqualToString:@"/"]
+-      || [pathdir isEqualToString:smarter]) {
++  if ([pathdir isEqualToString:@"/"] || [pathdir isEqualToString:smarter]) {
+     
++    if ([path isEqualToString:@"/"] || [self isUserCreatedFolder:path]) {
++      mode = 0700;
++    }
++    
+     attr = [NSDictionary dictionaryWithObjectsAndKeys:
+-      [NSNumber numberWithInt:0500], NSFilePosixPermissions,
++      [NSNumber numberWithInt:mode], NSFilePosixPermissions,
+       [NSNumber numberWithInt:geteuid()], NSFileOwnerAccountID,
+       [NSNumber numberWithInt:getegid()], NSFileGroupOwnerAccountID,
+       [NSDate date], NSFileCreationDate,
+Index: Source/SpotlightFS.h
+===================================================================
+--- Source/SpotlightFS.h	(.../tags/macfuse-0.4.0/filesystems-objc/SpotlightFS)	(revision 445)
++++ Source/SpotlightFS.h	(.../trunk/filesystems-objc/SpotlightFS)	(revision 445)
+@@ -45,6 +45,10 @@
+ //
+ - (NSArray *)userCreatedFolders;
+ 
++// Returns YES if |path| is a user created folder.
++//
++- (BOOL)isUserCreatedFolder:(NSString *)path;
++
+ // Sets the full user-created folders array.
+ //
+ - (void)setUserCreatedFolders:(NSArray *)folders;

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20070828/7752ebca/attachment.html


More information about the macports-changes mailing list