-
Notifications
You must be signed in to change notification settings - Fork 307
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix for 'Import Image(s)...' menu items in Linux and Windows #1416
Conversation
So with this fix applied, directories in the dialog listing are shown but appear disabled, and can't be selected? |
This seems like a good fix to me. Artists would still be able to drag a folder onto the window to import multiple images as a workaround. I wonder if we should apply this fix conditionally -- only for Windows/Linux. Artists on macOS would still be able to select folders then. |
The directories won't be disabled. However if the user selects the directory and clicks 'Open', instead of importing the directory into the project the folder will be opened within the dialog window. From there they'd have to select individual files from inside that folder before they actually import anything. The idea of a conditional fix seems viable since the select-by-directory feature is still there for Linux/Windows users through drag and drop. If you want I could add that sort of change to my current pull request or a new one, however I'd need to create a macOS VM to test it fully on my end. Currently I'm only working with Linux and Windows. |
Ok, so they would see inside the folder but could still select multiple files from it from the dialog right? Thanks for putting this together! |
@jkmdev Can you try the latest |
@audionerd Looks like it works fine in master. Didn't see any errors. As an aside I tried dragging the file folder into storyboarder's sketch plane on Linux and Windows and it didn't import anything; I can only import by selecting files within the folder, then dragging and dropping those. I tested this on a commit earlier than the one including this merge and the issue was still there. If this is an issue you'd want to have fixed I can take a look at it. |
Oh right – can't drag a folder, but can drag multiple images from a folder. I think that's fine for now. |
Fix for bug #1312
Removes the
openDirectory
property in thedialog.showOpenDialog
options object forimportImagesDialogue
. This will prevent a user's directory or images from being inaccessible when they select theImport Images to New Boards...
orImport Image and Replace...
options from theFile
menu on Linux or Windows.I took this approach because:
openFile
andopenDirectory
properties seem incompatible;openDirectory
will overrideopenFile
in Linux and Windows, making it so that users can't select individual files, only directories. In Windows the files are hidden entirely.dialog.showOpenDialog
options object aren't compatible withopenDirectory
. Electron itself is checking for these extensions against directories instead of files, making them inaccessible to the user. For example with the jpg filter applied, Documents.jpg will be accessible to a Linux user, but not Documents.The downside to this fix is that users will lose the ability to import images by choosing a directory. So I thought - if the idea is viable - that it might be worth it to add a new
Import Folder Contents to New Boards...
menu option that will handle folder imports. That way there won't be any conflicts between theopenFile
andopenDirectory
properties, and new logic could be added to thedialog.showOpenDialog
callback that will check if directory contents are an image or not.