NSString (NSStringPathExtensions)

来源:互联网 发布:seo学徒招聘 编辑:程序博客网 时间:2024/05/18 20:10

+ (NSString *)pathWithComponents:(NSArray *)components;

- (NSArray *)pathComponents;


- (BOOL)isAbsolutePath;


- (NSString *)lastPathComponent;

- (NSString *)stringByDeletingLastPathComponent;

- (NSString *)stringByAppendingPathComponent:(NSString *)str;


- (NSString *)pathExtension;

- (NSString *)stringByDeletingPathExtension;

- (NSString *)stringByAppendingPathExtension:(NSString *)str;


- (NSString *)stringByAbbreviatingWithTildeInPath;

- (NSString *)stringByExpandingTildeInPath;


- (NSString *)stringByStandardizingPath;


- (NSString *)stringByResolvingSymlinksInPath;


- (NSArray *)stringsByAppendingPaths:(NSArray *)paths;


- (NSUInteger)completePathIntoString:(NSString **)outputName caseSensitive:(BOOL)flag matchesIntoArray:(NSArray **)outputArray filterTypes:(NSArray *)filterTypes;


- (__strong const char *)fileSystemRepresentation;

- (BOOL)getFileSystemRepresentation:(char *)cname maxLength:(NSUInteger)max;


@end


@interface NSArray (NSArrayPathExtensions)


- (NSArray *)pathsMatchingExtensions:(NSArray *)filterTypes;


@end


FOUNDATION_EXPORT NSString *NSUserName(void);

FOUNDATION_EXPORT NSString *NSFullUserName(void);


FOUNDATION_EXPORT NSString *NSHomeDirectory(void);

FOUNDATION_EXPORT NSString *NSHomeDirectoryForUser(NSString *userName);


FOUNDATION_EXPORT NSString *NSTemporaryDirectory(void);


FOUNDATION_EXPORT NSString *NSOpenStepRootDirectory(void);


enum {

    NSApplicationDirectory = 1,            // supported applications (Applications)

    NSDemoApplicationDirectory,             // unsupported applications, demonstration versions (Demos)

    NSDeveloperApplicationDirectory,        // developer applications (Developer/Applications). DEPRECATED - there is no one single Developer directory.

    NSAdminApplicationDirectory,            // system and network administration applications (Administration)

    NSLibraryDirectory,                     // various documentation, support, and configuration files, resources (Library)

    NSDeveloperDirectory,                   // developer resources (Developer) DEPRECATED - there is no one single Developer directory.

    NSUserDirectory,                        // user home directories (Users)

    NSDocumentationDirectory,               // documentation (Documentation)

    NSDocumentDirectory,                    // documents (Documents)

    NSCoreServiceDirectory,                 // location of CoreServices directory (System/Library/CoreServices)

#if MAC_OS_X_VERSION_10_6 <= MAC_OS_X_VERSION_MAX_ALLOWED || __IPHONE_4_0 <= __IPHONE_OS_VERSION_MAX_ALLOWED

    NSAutosavedInformationDirectory = 11,  // location of autosaved documents (Documents/Autosaved)

#endif

    NSDesktopDirectory = 12,               // location of user's desktop

    NSCachesDirectory = 13,                // location of discardable cache files (Library/Caches)

    NSApplicationSupportDirectory = 14,    // location of application support files (plug-ins, etc) (Library/Application Support)

#if MAC_OS_X_VERSION_10_5 <= MAC_OS_X_VERSION_MAX_ALLOWED || __IPHONE_2_0 <= __IPHONE_OS_VERSION_MAX_ALLOWED

    NSDownloadsDirectory = 15,             // location of the user's "Downloads" directory

#endif

#if MAC_OS_X_VERSION_10_6 <= MAC_OS_X_VERSION_MAX_ALLOWED || __IPHONE_4_0 <= __IPHONE_OS_VERSION_MAX_ALLOWED

    NSInputMethodsDirectory = 16,          // input methods (Library/Input Methods)

    NSMoviesDirectory = 17,                // location of user's Movies directory (~/Movies)

    NSMusicDirectory = 18,                 // location of user's Music directory (~/Music)

    NSPicturesDirectory = 19,              // location of user's Pictures directory (~/Pictures)

    NSPrinterDescriptionDirectory = 20,    // location of system's PPDs directory (Library/Printers/PPDs)

    NSSharedPublicDirectory = 21,          // location of user's Public sharing directory (~/Public)

    NSPreferencePanesDirectory = 22,       // location of the PreferencePanes directory for use with System Preferences (Library/PreferencePanes)

    NSItemReplacementDirectory = 99,    // For use with NSFileManager's URLForDirectory:inDomain:appropriateForURL:create:error:

#endif

    NSAllApplicationsDirectory = 100,      // all directories where applications can occur

    NSAllLibrariesDirectory = 101          // all directories where resources can occur

};

typedef NSUInteger NSSearchPathDirectory;


enum {

    NSUserDomainMask = 1,      // user's home directory --- place to install user's personal items (~)

    NSLocalDomainMask = 2,     // local to the current machine --- place to install items available to everyone on this machine (/Library)

    NSNetworkDomainMask = 4,   // publically available location in the local area network --- place to install items available on the network (/Network)

    NSSystemDomainMask = 8,    // provided by Apple, unmodifiable (/System)

    NSAllDomainsMask = 0x0ffff // all domains: all of the above and future items

};

typedef NSUInteger NSSearchPathDomainMask;


FOUNDATION_EXPORT NSArray *NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory directory,NSSearchPathDomainMask domainMask, BOOL expandTilde);