很多程序有這樣的功能,雙擊某個圖片可以打開源文件,右鍵菜單中的Show in Finder功能,Cocoa中對這塊支持較好,有現成的方法:
[[NSWorkspace sharedWorkspace] openFile:fileName];
[[NSWorkspace sharedWorkspace] selectFile:fileName inFileViewerRootedAtPath:path]; // 如果只打開目錄不需要選中具體文件,fileName可為nil。
很多程序有這樣的功能,雙擊某個圖片可以打開源文件,右鍵菜單中的Show in Finder功能,Cocoa中對這塊支持較好,有現成的方法: [[NSWorkspace sharedWorkspace] openFile:fileName]; [[NSWorkspace sharedWorkspace] selectFile:fileName inFileViewerRootedAtPath:path]; // 如果只打開目錄不需要選中具體文件,fileName可為nil。
|
||||||||||||||||||||||