Thanks for doing this. I had it on my TODO list so I'm glad you did
it. Can you change the NSError+POSIX.h to import
<Foundation/Foundation.h> instead of Cocoa? That'll make it a bit
easier for anyone who wants to do a daemon based FS and use this
shorthand.
ted
On Jan 13, 2008 2:54 PM, Dave MacLachlan <[EMAIL PROTECTED]> wrote:
>
> Since this appears to be used by almost every objc file system, I have
> moved a copy of it into support and changed SpotlightFS and
> LoopbackFS. A future file system that I am going to submit uses it as
> well.
>
> Index: LoopbackFS/LoopbackFS.xcodeproj/project.pbxproj
> ===================================================================
> --- LoopbackFS/LoopbackFS.xcodeproj/project.pbxproj (revision 744)
> +++ LoopbackFS/LoopbackFS.xcodeproj/project.pbxproj (working copy)
> @@ -7,6 +7,7 @@
> objects = {
>
> /* Begin PBXBuildFile section */
> + 8B93BEEF0D3ACD4400466F25 /* NSError+POSIX.m in Sources */ =
> {isa =
> PBXBuildFile; fileRef = 8B93BEED0D3ACD4400466F25 /* NSError+POSIX.m
> */; };
> 8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */ =
> {isa =
> PBXBuildFile; fileRef = 29B97318FDCFA39411CA2CEA /* MainMenu.nib */; };
> 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */
> =
> {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /*
> InfoPlist.strings */; };
> 8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa =
> PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */;
> settings = {ATTRIBUTES = (); }; };
> @@ -26,6 +27,8 @@
> 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa =
> PBXFileReference; lastKnownFileType = wrapper.framework; name =
> AppKit.framework; path = /System/Library/Frameworks/AppKit.framework;
> sourceTree = "<absolute>"; };
> 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa =
> PBXFileReference; lastKnownFileType = wrapper.framework; name =
> Foundation.framework; path = /System/Library/Frameworks/
> Foundation.framework; sourceTree = "<absolute>"; };
> 32CA4F630368D1EE00C91783 /* LoopbackFS_Prefix.pch */ = {isa =
> PBXFileReference; fileEncoding = 4; lastKnownFileType =
> sourcecode.c.h; path = LoopbackFS_Prefix.pch; sourceTree = "<group>"; };
> + 8B93BEED0D3ACD4400466F25 /* NSError+POSIX.m */ = {isa =
> PBXFileReference; fileEncoding = 4; lastKnownFileType =
> sourcecode.c.objc; name = "NSError+POSIX.m"; path = "../Support/NSError
> +POSIX.m"; sourceTree = SOURCE_ROOT; };
> + 8B93BEEE0D3ACD4400466F25 /* NSError+POSIX.h */ = {isa =
> PBXFileReference; fileEncoding = 4; lastKnownFileType =
> sourcecode.c.h; name = "NSError+POSIX.h"; path = "../Support/NSError
> +POSIX.h"; sourceTree = SOURCE_ROOT; };
> 8D1107310486CEB800E47090 /* Info.plist */ = {isa =
> PBXFileReference; fileEncoding = 4; lastKnownFileType =
> text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
> 8D1107320486CEB800E47090 /* LoopbackFS.app */ = {isa =
> PBXFileReference; explicitFileType = wrapper.application;
> includeInIndex = 0; path = LoopbackFS.app; sourceTree =
> BUILT_PRODUCTS_DIR; };
> FF694BDB0D281C6900CD431F /* MacFUSE.framework */ = {isa =
> PBXFileReference; lastKnownFileType = wrapper.framework; name =
> MacFUSE.framework; path = /Library/Frameworks/MacFUSE.framework;
> sourceTree = "<absolute>"; };
> @@ -52,6 +55,8 @@
> 080E96DDFE201D6D7F000001 /* Classes */ = {
> isa = PBXGroup;
> children = (
> + 8B93BEED0D3ACD4400466F25 /* NSError+POSIX.m
> */,
> + 8B93BEEE0D3ACD4400466F25 /* NSError+POSIX.h
> */,
> FF8358210D24649E002F2357 /* LoopbackFS.h */,
> FF8358220D24649E002F2357 /* LoopbackFS.m */,
> FF98B8B60D24909700117156 /*
> LoopbackController.h */,
> @@ -187,6 +192,7 @@
> 8D11072D0486CEB800E47090 /* main.m in Sources
> */,
> FF8358230D24649E002F2357 /* LoopbackFS.m in
> Sources */,
> FF98B8B80D24909700117156 /*
> LoopbackController.m in Sources */,
> + 8B93BEEF0D3ACD4400466F25 /* NSError+POSIX.m
> in Sources */,
> );
> runOnlyForDeploymentPostprocessing = 0;
> };
> Index: LoopbackFS/LoopbackFS.m
> ===================================================================
> --- LoopbackFS/LoopbackFS.m (revision 744)
> +++ LoopbackFS/LoopbackFS.m (working copy)
> @@ -31,17 +31,8 @@
> #import <sys/stat.h>
> #import "LoopbackFS.h"
> #import <MacFUSE/GMUserFileSystem.h>
> +#import "NSError+POSIX.h"
>
> -// Category on NSError to simplify creating an NSError based on
> posix errno.
> [EMAIL PROTECTED] NSError (POSIX)
> -+ (NSError *)errorWithPOSIXCode:(int)code;
> [EMAIL PROTECTED]
> [EMAIL PROTECTED] NSError (POSIX)
> -+ (NSError *)errorWithPOSIXCode:(int) code {
> - return [NSError errorWithDomain:NSPOSIXErrorDomain code:code
> userInfo:nil];
> -}
> [EMAIL PROTECTED]
> -
> @implementation LoopbackFS
>
> #if 1
> Index: SpotlightFS/Source/SpotlightFS.m
> ===================================================================
> --- SpotlightFS/Source/SpotlightFS.m (revision 746)
> +++ SpotlightFS/Source/SpotlightFS.m (working copy)
> @@ -49,17 +49,8 @@
> #import <Foundation/Foundation.h>
> #import <MacFUSE/GMUserFileSystem.h>
> #import "SpotlightFS.h"
> +#import "NSError+POSIX.h"
>
> -// Category on NSError to simplify creating an NSError based on
> posix errno.
> [EMAIL PROTECTED] NSError (POSIX)
> -+ (NSError *)errorWithPOSIXCode:(int)code;
> [EMAIL PROTECTED]
> [EMAIL PROTECTED] NSError (POSIX)
> -+ (NSError *)errorWithPOSIXCode:(int) code {
> - return [NSError errorWithDomain:NSPOSIXErrorDomain code:code
> userInfo:nil];
> -}
> [EMAIL PROTECTED]
> -
> // Key name for use in NSUserDefaults
> static NSString* const kDefaultsSearchDirectories =
> @"SearchDirectories";
>
> Index: SpotlightFS/SpotlightFS.xcodeproj/project.pbxproj
> ===================================================================
> --- SpotlightFS/SpotlightFS.xcodeproj/project.pbxproj (revision 744)
> +++ SpotlightFS/SpotlightFS.xcodeproj/project.pbxproj (working copy)
> @@ -7,6 +7,7 @@
> objects = {
>
> /* Begin PBXBuildFile section */
> + 8B93BE9C0D3ACCEF00466F25 /* NSError+POSIX.m in Sources */ =
> {isa =
> PBXBuildFile; fileRef = 8B93BE9B0D3ACCEF00466F25 /* NSError+POSIX.m
> */; };
> 8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */ =
> {isa =
> PBXBuildFile; fileRef = 29B97318FDCFA39411CA2CEA /* MainMenu.nib */; };
> 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */
> =
> {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /*
> InfoPlist.strings */; };
> 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ =
> {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /*
> Cocoa.framework */; };
> @@ -31,6 +32,8 @@
> 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa =
> PBXFileReference; lastKnownFileType = wrapper.framework; name =
> AppKit.framework; path = /System/Library/Frameworks/AppKit.framework;
> sourceTree = "<absolute>"; };
> 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa =
> PBXFileReference; lastKnownFileType = wrapper.framework; name =
> Foundation.framework; path = /System/Library/Frameworks/
> Foundation.framework; sourceTree = "<absolute>"; };
> 32CA4F630368D1EE00C91783 /* SpotlightFS_Prefix.pch */ = {isa =
> PBXFileReference; fileEncoding = 4; lastKnownFileType =
> sourcecode.c.h; path = SpotlightFS_Prefix.pch; sourceTree =
> "<group>"; };
> + 8B93BE9A0D3ACCEF00466F25 /* NSError+POSIX.h */ = {isa =
> PBXFileReference; fileEncoding = 4; lastKnownFileType =
> sourcecode.c.h; name = "NSError+POSIX.h"; path = "../Support/NSError
> +POSIX.h"; sourceTree = SOURCE_ROOT; };
> + 8B93BE9B0D3ACCEF00466F25 /* NSError+POSIX.m */ = {isa =
> PBXFileReference; fileEncoding = 4; lastKnownFileType =
> sourcecode.c.objc; name = "NSError+POSIX.m"; path = "../Support/NSError
> +POSIX.m"; sourceTree = SOURCE_ROOT; };
> 8D1107310486CEB800E47090 /* Info.plist */ = {isa =
> PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist;
> path = Info.plist; sourceTree = "<group>"; };
> 8D1107320486CEB800E47090 /* SpotlightFS.app */ = {isa =
> PBXFileReference; explicitFileType = wrapper.application;
> includeInIndex = 0; path = SpotlightFS.app; sourceTree =
> BUILT_PRODUCTS_DIR; };
> F927CCFF0B6405DC00AF272E /* DynamicFolderBlue.icns */ = {isa =
> PBXFileReference; lastKnownFileType = image.icns; path =
> DynamicFolderBlue.icns; sourceTree = "<group>"; };
> @@ -136,6 +139,8 @@
> F9CEEF7D0B617DCE0044EAA6 /* main.m */,
> FFBB2A410D2E16D3001331D2 /*
> SpotlightFSController.h */,
> FFBB2A420D2E16D3001331D2 /*
> SpotlightFSController.m */,
> + 8B93BE9A0D3ACCEF00466F25 /* NSError+POSIX.h
> */,
> + 8B93BE9B0D3ACCEF00466F25 /* NSError+POSIX.m
> */,
> );
> path = Source;
> sourceTree = "<group>";
> @@ -203,6 +208,7 @@
> F9CEEF7E0B617DCE0044EAA6 /* main.m in Sources
> */,
> F9CEEFD60B6198610044EAA6 /* SpotlightFS.m in
> Sources */,
> FFBB2A430D2E16D3001331D2 /*
> SpotlightFSController.m in Sources */,
> + 8B93BE9C0D3ACCEF00466F25 /* NSError+POSIX.m
> in Sources */,
> );
> runOnlyForDeploymentPostprocessing = 0;
> };
> Index: Support/NSError+POSIX.m
> ===================================================================
> --- Support/NSError+POSIX.m (revision 0)
> +++ Support/NSError+POSIX.m (revision 0)
> @@ -0,0 +1,28 @@
> +//
> +// NSError+POSIX.m
> +//
> +// ================================================================
> +// Copyright (C) 2008 Google Inc.
> +//
> +// Licensed under the Apache License, Version 2.0 (the "License");
> +// you may not use this file except in compliance with the License.
> +// You may obtain a copy of the License at
> +//
> +// http://www.apache.org/licenses/LICENSE-2.0
> +//
> +// Unless required by applicable law or agreed to in writing, software
> +// distributed under the License is distributed on an "AS IS" BASIS,
> +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> implied.
> +// See the License for the specific language governing permissions and
> +// limitations under the License.
> +// ================================================================
> +//
> +
> +#import "NSError+POSIX.h"
> +
> [EMAIL PROTECTED] NSError (POSIX)
> ++ (NSError *)errorWithPOSIXCode:(int) code {
> + return [NSError errorWithDomain:NSPOSIXErrorDomain code:code
> userInfo:nil];
> +}
> [EMAIL PROTECTED]
> +
> Index: Support/NSError+POSIX.h
> ===================================================================
> --- Support/NSError+POSIX.h (revision 0)
> +++ Support/NSError+POSIX.h (revision 0)
> @@ -0,0 +1,26 @@
> +//
> +// NSError+POSIX.h
> +//
> +// ================================================================
> +// Copyright (C) 2008 Google Inc.
> +//
> +// Licensed under the Apache License, Version 2.0 (the "License");
> +// you may not use this file except in compliance with the License.
> +// You may obtain a copy of the License at
> +//
> +// http://www.apache.org/licenses/LICENSE-2.0
> +//
> +// Unless required by applicable law or agreed to in writing, software
> +// distributed under the License is distributed on an "AS IS" BASIS,
> +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> implied.
> +// See the License for the specific language governing permissions and
> +// limitations under the License.
> +// ================================================================
> +//
> +
> +#import <Cocoa/Cocoa.h>
> +
> +// Category on NSError to simplify creating an NSError based on
> posix errno.
> [EMAIL PROTECTED] NSError (POSIX)
> ++ (NSError *)errorWithPOSIXCode:(int)code;
> [EMAIL PROTECTED]
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"macfuse-devel" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/macfuse-devel?hl=en
-~----------~----~----~----~------~----~------~--~---