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

Parameter initialDirectory of getDirectoryPath() not working on Windows #970

Closed
1 of 4 tasks
julianklose opened this issue Feb 20, 2022 · 2 comments
Closed
1 of 4 tasks
Labels
desktop The issue applies to Windows, Linux or MacOS implementations. help wanted Extra attention is needed new issue An issue that hasn't yet been seen from the maintainer

Comments

@julianklose
Copy link

Describe the bug
I'm using the newest version (4.4.0) of the file_picker including the new initialDirectory option. I tried using it with the directory picker. Unfortunately, it doesn't seem to work, I always start at my home directory.

Platform

  • Android
  • iOS
  • Web
  • Desktop

Platform OS version
Windows 10

How are you picking?

var dir = await FilePicker.platform.getDirectoryPath(
        lockParentWindow: true, initialDirectory: Directory.current.path);

Flutter Version details
[√] Flutter (Channel stable, 2.10.1, on Microsoft Windows [Version 10.0.19044.1526], locale de-DE)
• Flutter version 2.10.1 at C:\Users\JulianKlose\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision db747aa133 (11 days ago), 2022-02-09 13:57:35 -0600
• Engine revision ab46186b24
• Dart version 2.16.1
• DevTools version 2.9.2

[√] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
• Android SDK at C:\Users\JulianKlose\AppData\Local\Android\sdk
• Platform android-32, build-tools 32.1.0-rc1
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.11+9-b60-7590822)
• All Android licenses accepted.

[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop for Windows (Visual Studio Build Tools 2019 16.11.9)
• Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools
• Visual Studio Build Tools 2019 version 16.11.32106.194
• Windows 10 SDK version 10.0.19041.0

[√] Android Studio (version 2021.1)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.11+9-b60-7590822)

[√] VS Code (version 1.64.2)
• VS Code at C:\Users\JulianKlose\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.34.0

[√] Connected device (3 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19044.1526]
• Chrome (web) • chrome • web-javascript • Google Chrome 98.0.4758.102
• Edge (web) • edge • web-javascript • Microsoft Edge 96.0.1054.62

[√] HTTP Host Availability
• All required HTTP hosts are available

• No issues found!

@julianklose julianklose added the new issue An issue that hasn't yet been seen from the maintainer label Feb 20, 2022
@julianklose
Copy link
Author

julianklose commented Feb 20, 2022

I just read in #953, that it doesn't work with the windows directory picker. Maybe it will with #915. Can you add a notice about this in the documentation until it works?

@philenius
Copy link
Collaborator

Hi @julianklose , thank you for noticing this. The Dart docs will be fixed with #915 and I already updated the API section of our wiki.

Fortunately, Microsoft's IFileDialog API supports setting the initial directory even when picking a directory. However, I don't understand how to use it. So, setting the initial directory for the directory picker dialog is still not possible in file_picker. Sorry for the inconveniences.
I added a TODO to our code for the missing implementation and I'll close this issue until I or someone else finds out how to use the SetFolder() / SetDefaultFolder() methods.

@philenius philenius added the desktop The issue applies to Windows, Linux or MacOS implementations. label Feb 20, 2022
@philenius philenius changed the title initialDirectory not working Paremter initialDirectory of getDirectoryPath() not working on Windows Feb 20, 2022
@philenius philenius changed the title Paremter initialDirectory of getDirectoryPath() not working on Windows Parameter initialDirectory of getDirectoryPath() not working on Windows Feb 20, 2022
@philenius philenius added the help wanted Extra attention is needed label Feb 20, 2022
miguelpruivo added a commit that referenced this issue Mar 20, 2024
…ory-windows

#970 Support setting an initial directory in getDirectoryPath() on Windows
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
desktop The issue applies to Windows, Linux or MacOS implementations. help wanted Extra attention is needed new issue An issue that hasn't yet been seen from the maintainer
Projects
None yet
Development

No branches or pull requests

2 participants