-stringByStandardizingPath:
INDEX>Foundation>NSString>-stringByStandardizingPath:
解説
指定した文字をパスとみなして、パスをスタンダード化します。
● -stringByExpandingTildeInPathを使ってチルダ付き「~/」をフルパス「User/username/」に変えます。
● 空のコンポーネントがあれば、それを減らします。「//」や「/./」は「/」に
● シンボリックリンク(エイリアス)を本当のファイルに変えます。
● 最初のコンポーネントを削除します。
返り値
( NSString * )
文字列
引数
フレームワーク
Foundation
クラス
NSString
Instance Methods
使用可能
10.0
参照
- stringByExpandingTildeInPath
- stringByResolvingSymlinksInPath
例文
#import "MyObject.h" @implementation MyObject - (IBAction)myAction:(id)sender { NSString *str = @"~/"; NSFileManager *myFile = [ NSFileManager defaultManager]; [myFile changeCurrentDirectoryPath:[str stringByStandardizingPath]]; NSLog([myFile currentDirectoryPath]); } @end