initDirectoryWithFileWrappers:
辞書でディレクトリラッパを初期化して返します
-(id)initDirectoryWithFileWrappers:(NSDictionary *)wrappers:
解説
辞書でディレクトリラッパを初期化して返します。
返り値
( id )
ファイルラッパ
引数
( NSDictionary * )wrappers
辞書
フレームワーク
ApplicationKit
クラス
NSFileWrapper
Instance Methods
使用可能
10.0
参照
- setPreferredFilename:
- filename
- setFileAttributes:
例文
#import "MyObject.h" @implementation MyObject - (IBAction)myAction:(id)sender { NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt:511],@"NSFilePosixPermissions", @"NSFileTypeDirectory",@"NSFileType", nil]; NSFileWrapper *theWrapper = [[NSFileWrapper alloc] initDirectoryWithFileWrappers:nil ]; ([theWrapper writeToFile:@"/testfolder" atomically:YES updateFilenames:YES]) ? NSLog(@"YES") : NSLog(@"NO"); NSLog([theWrapper description]); /* NSFileCreationDate = 2003-05-02 17:10:24 +0900; NSFileGroupOwnerAccountID = 99; NSFileGroupOwnerAccountName = unknown; NSFileModificationDate = 2003-05-02 17:10:24 +0900; NSFileOwnerAccountID = 501; NSFileOwnerAccountName = oomori; NSFileReferenceCount = 1; NSFileSize = 2621; NSFileSystemFileNumber = 661772; NSFileSystemNumber = 234881059; */ if ([theWrapper writeToFile:@"/aaa" atomically:YES updateFilenames:YES]) { NSLog(@"YES"); }else{ NSLog(@"NO"); } [theWrapper setPreferredFilename:@"dir"]; NSLog([[theWrapper fileAttributes] description]); } @end