我向发现者询问当前的发现者窗口位置/路径/用
做什么NSString *path = [[finder insertionLocation] get];
导致类似的路径:
2011-06-03 18:38:55.132 CutIt[1980:903] <FinderFolder @0x1561d960: FinderFolder "eike" of FinderFolder "Users" of startupDisk of application "Finder" (185)>
有一种常用的方法可以将其转换为可用的路径,例如/users/eike
,还是我必须自己修补一些东西?
答案 0 :(得分:3)
有点嵌套,但您可以根据需要进行划分:
NSString *path = [[NSURL URLWithString:[[[finder insertionLocation] get] URL]] path];
答案 1 :(得分:1)
如果有人有兴趣,这里有一种方法可以获得没有投射警告的路径:
NSURL *insertLocation = [[[finder insertionLocation] get] URL];
NSString *path = [[NSURL URLWithString:[NSString stringWithFormat:@"%@",insertLocation]] path];