KRTirtho / flemozi

Advanced⚡ Emoji Picker😀 for Linux🐧, Windows🪟 and macOS🍎
GNU General Public License v3.0
210 stars 5 forks source link

application does not start: `MissingPlatformDirectoryException` #2

Closed christian-heusel closed 1 year ago

christian-heusel commented 1 year ago
$ 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 commented 1 year ago

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

christian-heusel commented 1 year ago

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 commented 1 year ago

@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 commented 1 year ago

Thanks a lot, that solved the issue! 😄

skreborn commented 1 year ago

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

KRTirtho commented 1 year ago

@skreborn the problem is caused by hive_flutter as it by default uses the documents dir (It shouldn't. I don't know why :confused:) 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