NSString (NSStringPathExtensions)

132 篇文章 0 订阅

+ (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);

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值