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

Bugfix for incorrect result parsing of the save-file dialog on Windows #1265

Merged

Conversation

philenius
Copy link
Collaborator

@philenius philenius commented Apr 17, 2023

Fixes #1257: Previously, the save-file dialog returned an incorrect result if

  • a very long default file name was set (e.g. abcdefghijklmnopqrstuvxyz0123456789.png)

and

  • the user selected a file with a much short file name (e.g. Test).

Then, in some cases, file_picker returned a mixed result of the actually picked file and the default file name, e.g. C:\Users\user\Desktop\Test\6789.png.

See screen recording for better understanding:

After this bugfix:
bugfix

Additional changes:

  • Reverted my previous changes to the README. I replaced the MP4 screen recording videos by GIF files as the videos would not be rendered on pub.dev. I payed attention to keep the file sizes of the GIFs small.

  • Improved code coverage of the Windows implementation by adding additional tests (from 8.1% to 17.6%). Let's say, there's much potential for improvement 😁
    Previously:
    Screenshot 2023-04-17 232145
    Now:
    Screenshot 2023-04-17 232234

@philenius philenius changed the title #1257: bugfix for incorrect result parsing of the save-file dialog on windows Bugfix for incorrect result parsing of the save-file dialog on Windows Apr 17, 2023
@philenius
Copy link
Collaborator Author

@YarostheLaunchpadder can you please confirm whether with this pull request the save-file dialog works as expected even when given a long default file name?

@philenius philenius self-assigned this Apr 17, 2023
Somehow, as opposed to the official documentation by Microsoft, if the
save-file dialog is invoked with a long default file name (e.g.
`abcdefghijklmnopqrstuvxyz0123456789.png`) and the user changed the
file name to a short one (e.g. `test.txt`), then the field
`lpstrFile` not only  contains the selected file `test.txt` but also,
separated by only one `null` character, some remaining part of the
originally given default file name.
The screen recordings uploaded to GitHub worked fine on GitHub but would
not be display on pub.dev. Hence, revert to committing GIF files to our
Git repo.
@philenius philenius force-pushed the bugfix/#1257-incorrect-result-parsing-save-file-windows branch from fc9e7ab to cb95746 Compare April 17, 2023 21:31
@YarosMallorca
Copy link

@philenius This seems to have fixed the issue, at least in my testing.
Thanks!

@philenius philenius marked this pull request as ready for review April 18, 2023 22:56
@miguelpruivo miguelpruivo merged commit eea91e0 into master Apr 19, 2023
@miguelpruivo miguelpruivo deleted the bugfix/#1257-incorrect-result-parsing-save-file-windows branch April 19, 2023 15:56
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

Successfully merging this pull request may close these issues.

Windows Save Dialog overrides names when fileName is defined
3 participants