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

application does not start: MissingPlatformDirectoryException #2

Closed
christian-heusel opened this issue Mar 28, 2023 · 6 comments
Closed

Comments

@christian-heusel
Copy link
Contributor

$ flutter run
Launching lib/main.dart on Linux in debug mode...
Building Linux application...
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: MissingPlatformDirectoryException(Unable to get application documents directory)
#0      getApplicationDocumentsDirectory (package:path_provider/path_provider.dart:122:5)
<asynchronous suspension>
#1      HiveX.initFlutter (package:hive_flutter/src/hive_extensions.dart:12:18)
<asynchronous suspension>
#2      QueryClient.initialize (package:fl_query/src/core/client.dart:345:5)
<asynchronous suspension>
#3      main (package:flemozi/main.dart:86:3)
<asynchronous suspension>

Syncing files to device Linux...                                   178ms

Infos about the system:

$ flutter --version                                                             64 ↵
Flutter 3.7.5 • channel stable • https://github.com/flutter/flutter.git
Framework • revision c07f788888 (5 weeks ago) • 2023-02-22 17:52:33 -0600
Engine • revision 0f359063c4
Tools • Dart 2.19.2 • DevTools 2.20.1

$ uname -a
Linux meterpeter 6.2.8-arch1-1 #1 SMP PREEMPT_DYNAMIC Wed, 22 Mar 2023 22:52:35 +0000 x86_64 GNU/Linux
@KRTirtho
Copy link
Owner

Your system doesn't have ~/Documents directory? flutter_hive requires it initially

@christian-heusel
Copy link
Contributor Author

My system does have ~/Documents, thats why I am opening this bug :D

$ realpath ~/Documents
/home/chris/Documents

Do you have any Idea what else could cause this problem?

@skreborn
Copy link

@christian-heusel flemozi (transitively) depends on path_provider to supply the correct directory paths. On Linux, getApplicationDocumentsDirectory calls the corresponding platform function getApplicationDocumentsPath, which in turn calls xdg.getUserDirectory, which simply gives up if the xdg-user-dir executable isn't available on your path, so perhaps you could check if it is as a first step.

@christian-heusel
Copy link
Contributor Author

Thanks a lot, that solved the issue! 😄

@skreborn
Copy link

@KRTirtho Should we perhaps open an issue instead to handle this gracefully?

@KRTirtho
Copy link
Owner

@skreborn the problem is caused by hive_flutter as it by default uses the documents dir (It shouldn't. I don't know why 😕) to store all the db and db.cache files. This is something needs to be fixed on the path_provider side and a requirement of xdg-user-dirs should be stated in their readme

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants