如何阻止 OSX 上运行的 wxFileDialog 将 .itlp 包视为文件?
我正在开发一个程序,我需要能够打开包含 itlp (iTunes LP) 的 zip 文件,然后对其进行操作。为此,我在 wxPython 中使用 wxFileDialog,使用适当的通配符仅显示 zip 文件。
问题是,因为 itlp 是文件夹而不是文件,所以它们仍然显示在文件对话框中,但如果您尝试打开它们,它们会被视为文件,并且 FileDialog 会返回路径,就像它是文件一样,而不是导航到他们就像文件夹一样。这可能只发生在 OSX 上,我没有在任何其他平台上尝试过,我模糊地记得基于 Unix 的操作系统比 Windows 更重视文件扩展名。
所以我的问题是我能做些什么来隐藏文件对话框中的 itlps,或者让它像普通文件夹而不是文件一样对待它们?
I'm working on a program for which I need to be able to open a zip file containing an itlp (iTunes LP) and then do stuff to it. I'm using wxFileDialog in wxPython for this purpose using the appropriate wildcard to only show zip files.
The problem is that because itlp's are folders not files they are still shown in the file dialog, but if you try to open them they're treated as files and the FileDialog returns the path as it would if it were a file instead of navigating into them like it would for a folder. This may only happen on OSX, I've not tried it on any other platform, I've got vague recollections that Unix based OSs take file extensions more seriously than windows.
So my question here is what can I do to either hide the itlps in the file dialog, or get it to treat them like normal folders, not files?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
听起来您正在尝试使用文件对话框打开文件。 wxPython 尽可能地包装本机小部件,因此我猜测它的行为方式与普通文件对话框相同。尝试使用加载该对话框的不同程序打开该文件,它的行为可能会相同。在 Windows 上,当我需要打开 zip 文件时,我会使用 zip 程序或使用 Windows 内置的程序。文件对话框不会打开它们。
It sounds like you're trying to open a file with a file dialog. wxPython wraps the native widgets where ever possible, so I'm guessing it's behaving the same way that the normal file dialog does. Try opening the file with a different program that loads that dialog and it'll probably behave the same way. On Windows when I need to open a zip file, I use a zip program or use the one built into Windows. File dialogs don't open them.