我正在开发一个应用程序,其中安装了USB笔式驱动器后,该应用程序将直接打开USB驱动器并显示所有文件夹视图。
[[NSWorkspace sharedWorkspace] selectFile:@"/volumes/LIVE/" inFileViewerRootedAtPath:@"/Volumes/LIVE/"];
这里的“ LIVE”是笔式驱动器的名称。当仅在打开LIVE路径之前打开文件夹,但是我无法查看“ Live”中的文件夹时,如何访问“ LIVE”中可用的子文件夹。
谢谢你提前!
我知道了
NSFileManager *fileManager = [NSFileManager defaultManager];
NSArray *theFiles = [fileManager contentsOfDirectoryAtURL:[NSURL fileURLWithPath:@"/volumes/LIVE/"]includingPropertiesForKeys:[NSArray arrayWithObject:NSURLNameKey]
options:NSDirectoryEnumerationSkipsHiddenFiles error:nil];
[[NSWorkspace sharedWorkspace] activateFileViewerSelectingURLs:theFiles];
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句