Skip to content
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

Selecting .app files is impossible on MacOS #856

Closed
1 task done
FilledStacks opened this issue Oct 18, 2021 · 2 comments · Fixed by #858
Closed
1 task done

Selecting .app files is impossible on MacOS #856

FilledStacks opened this issue Oct 18, 2021 · 2 comments · Fixed by #858
Assignees
Labels
bug Something isn't working desktop The issue applies to Windows, Linux or MacOS implementations.

Comments

@FilledStacks
Copy link

The bug
When using the file picker and I select the file Runner.app it throws the following exception.

FileSystemException: Cannot retrieve length of file, path = '/Volumes/Macintosh/Users/danemackier/Desktop/testsweets-example/build/ios/Debug-iphoneos/Runner.app' (OS Error: Is a directory, errno = 21)

And when I use the getDirectoryPath function the Runner.app is not available for selection. So it's impossible to select a .app file at the moment

Platform

  • [] Android
  • [] iOS
  • [] Web
  • Desktop (Go)

Platform OS version
macOS Big Sur Version 11.6

How are you picking?

FilePickerResult? file = await FilePicker.platform.pickFiles(
  type: FileType.custom,
  allowedExtensions: ['app', 'ipa'],
);

Details to reproduce the issue

  1. Create a folder Runner.app
  2. Open the file picker with the snippet above
  3. Select the Runner.app file
  4. See exception

Error Log

FileSystemException: Cannot retrieve length of file, path = '/Volumes/Macintosh/Users/danemackier/Desktop/testsweets-example/build/ios/Debug-iphoneos/Runner.app' (OS Error: Is a directory, errno = 21)

Flutter Version details

Flutter version details [✓] Flutter (Channel stable, 2.5.1, on macOS 11.6 20G165 darwin-x64, locale en-ZA) • Flutter version 2.5.1 at /Users/danemackier/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision ffb2ecea52 (4 weeks ago), 2021-09-17 15:26:33 -0400 • Engine revision b3af521a05 • Dart version 2.14.2

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /Users/danemackier/Library/Android/sdk
• Platform android-31, build-tools 31.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.5.1, Build version 12E507
• CocoaPods version 1.11.2

[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 3.5)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 44.0.1
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

[✓] VS Code (version 1.61.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.27.0

[✓] Connected device (2 available)
• macOS (desktop) • macos • darwin-x64 • macOS 11.6 20G165 darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 94.0.4606.81

Additional context
We need to select the .app file because we're building an end-to-end testing tool and need to select the app to load onto the device. So selecting a .app folder is important for deploying the app to the simulator.

@FilledStacks FilledStacks added the new issue An issue that hasn't yet been seen from the maintainer label Oct 18, 2021
@philenius philenius self-assigned this Oct 18, 2021
@philenius philenius added the desktop The issue applies to Windows, Linux or MacOS implementations. label Oct 18, 2021
@miguelpruivo miguelpruivo added bug Something isn't working and removed new issue An issue that hasn't yet been seen from the maintainer labels Oct 19, 2021
philenius added a commit that referenced this issue Oct 20, 2021
.app files on macOS are actually directories. But, they are treated as
files by the file picker and therefore can only be selected via
'FilePicker.platform.pickFiles()'. When picking .app files,
'createPlatformFile()' tries to get the size of the .app file which
throws an exception because directories don't have an inherent size.
miguelpruivo pushed a commit that referenced this issue Oct 20, 2021
…n-macos

Fixes bug #856 that .app files could not be picked on macOS
@philenius
Copy link
Collaborator

@miguelpruivo , thank you for merging. Could you please publish version 4.1.6 to pub.dev? I can't see it in the list of published versions: https://pub.dev/packages/file_picker/versions

@miguelpruivo
Copy link
Owner

Done @philenius, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working desktop The issue applies to Windows, Linux or MacOS implementations.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants