halildurmus / filepicker_windows

File and directory picker for Windows that uses common dialog controls.
BSD 3-Clause "New" or "Revised" License
68 stars 19 forks source link

Shortcut doesn't open #27

Closed aampor-12 closed 7 months ago

aampor-12 commented 7 months ago

when I chose a shortcut it says : catastrophic failure

can you fix it please

Thank you for the great Package,

halildurmus commented 7 months ago

It works on my machine. Could you please share the code you're using?

Here's the one I used:

import 'package:filepicker_windows/filepicker_windows.dart';

void main() {
  final file = OpenFilePicker()..title = 'Select a file';

  final result = file.getFile();
  if (result != null) {
    print(result.path);
  }
}
aampor-12 commented 7 months ago

that's my code :

roby() { final file = OpenFilePicker()..title = 'select a file';

final result = file.getFile(); if (result != null) { return result.path; } } catastrophic failure

halildurmus commented 7 months ago

Interesting, I have no idea why it doesn't work on your machine.

halildurmus commented 7 months ago

I found this on StackOverflow, which seems to be the same issue you're experiencing.

The answer got me thinking, can you clone this repository and add this line

options |= FILEOPENDIALOGOPTIONS.FOS_NODEREFERENCELINKS;

to open_file_picker.dart and run the example?

Screenshot 2024-02-04 223629

halildurmus commented 7 months ago

Just published a new version that has a new field: dereferenceLinks. By setting it to false, you can now directly open the shortcut file without resolving its target if that's what you want.