Sivan22 / otzaria

A modern app that brings the jewish library to any device
https://sivan22.github.io/otzaria-download/
74 stars 8 forks source link

FilePicker doesn't exit after selecting a valid director (tested on Mac) #143

Closed mendelg closed 1 week ago

mendelg commented 1 week ago

Describe the bug

The FilePicker in the Flutter application does not exit after selecting a valid directory. The application is expected to exit the FilePicker and return the selected directory path when a valid directory is selected. However, it continues to ask for a directory even after a valid one is selected.

Steps to reproduce

  1. Run the application.
  2. When prompted, select a directory using the FilePicker.
  3. Choose a directory named 'אוצריא'.
  4. Notice that the FilePicker does not exit and continues to ask for a directory.

Expected behavior

After selecting a valid directory, the FilePicker should exit and return the selected directory path. The application should then proceed with its next steps using the selected directory.

Environment

Additional context

The relevant part of the code is in Main.dart, in the main function:

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await () async {
    //first try to get the library path from settings
    String? libraryPath = Settings.getValue('key-library-path');

    ....
    // here's the relevant code that causes the fail
    while (libraryPath == null ||
        (!Directory('$libraryPath${Platform.pathSeparator}אוצריא')
            .existsSync())) {
      libraryPath = await FilePicker.platform
          .getDirectoryPath(dialogTitle: "fzהגדר את מיקום ספריית אוצריא");
      Settings.setValue('key-library-path', libraryPath);
    }
  }();
  runApp(const OtzariaApp());
}

where the application asks the user to select a directory. The loop should exit when a directory named 'אוצריא' is selected. However, even after selecting a directory named 'אוצריא', the FilePicker doesn't exit and keeps asking for a directory.

It never exits this window:

image
mendelg commented 1 week ago

Ok, I should have also read the releases readme file:

build for macOS is available, thanks to Yossi Zahn!. download the macos.zip file and the library.7z archive. the app wll ask you to provide the library path on the first run.