0

im asking the finder for the current finder window location/path/whatever with

NSString *path = [[finder insertionLocation] get];

which results in a path like that:

2011-06-03 18:38:55.132 CutIt[1980:903] <FinderFolder @0x1561d960: FinderFolder "eike" of FinderFolder "Users" of startupDisk of application "Finder" (185)>

is there a common way to convert that into a usable path, like /users/eike, or do i have to patch something together myself?

4

2 に答える 2

3

少し入れ子になっていますが、好きなように分割できます。

NSString *path = [[NSURL URLWithString:[[[finder insertionLocation] get] URL]] path];
于 2011-06-03T16:48:37.393 に答える
1

興味のある方のために、キャスト警告なしでパスを取得する方法を次に示します。

NSURL *insertLocation = [[[finder insertionLocation] get] URL];
NSString *path = [[NSURL URLWithString:[NSString stringWithFormat:@"%@",insertLocation]] path];
于 2012-09-01T18:00:28.513 に答える