在 MacOS 应用程序中,我使用 NSOpenPanel
以便用户可以浏览和选择多个图像,如下所示:
NSOpenPanel *panel = [NSOpenPanel openPanel];
panel.canChooseDirectories = NO;
panel.canChooseFiles = YES;
panel.allowsMultipleSelection = YES;
panel.resolvesAliases = YES;
panel.allowedFileTypes = [NSImage imageTypes];
panel beginWithCompletionHandler:^(NSModalResponse result) {
...
这很好用,除非文件是符号链接(下图左图),但是当使用符号链接时,用户只能选择单个图像(下图右图):
images-A
文件夹中的文件是符号链接:
有一些较早的相关问题:
我在这里没有使用别名,我不在乎路径是如何解析的。
知道如何允许使用 NSOpenPanel
选择多个链接吗?