flutter_secure_storage icon indicating copy to clipboard operation
flutter_secure_storage copied to clipboard

CompanyName and CompanyProduct on Windows are ignored when the lang-charset in the Runner.rc file is not 040904e4

Open tonka3000 opened this issue 2 years ago • 0 comments

Hi,

first, thanks for the great library.

I tried to integrate it into my app, which run on Windows and it works great. I now check the location where the file are stored on disk.

Current Behavior

I read #550 and saw that the path should be /Users/<Username>/AppData/Roaming/<CompanyName>/<ProductName>/ but in my case it was /Users/<Username>/AppData/Roaming/.

I check the latest code and found the following line https://github.com/mogol/flutter_secure_storage/blob/bdd191faa0ac5e53470e0dd0409849d9ff310a95/flutter_secure_storage_windows/windows/flutter_secure_storage_windows_plugin.cpp#L239

and saw that the lang-charset needs to 040904e4 otherwise the data is ignore and therefor skip the /<CompanyName>/<ProductName>/ part in the full path of the file. Technically this still works, but this is very unusual for Windows apps.

Problem

When somebody use a different lang-charset than 040904e4 the path is "wrong" (or more precise unusual).

My case: I use squirrel.windows to update my app, and it requires to have a 040904B0 block (see here) so I'm not able to just change it.

Workaround

Adding a extra 040904E4 block (for the case that another lang-charset is used. This works fine.

But this should be documented for new users to don't fall into the same trap.

Possible Fix

A possible fix would be to loop through some known, often used lang-charsets like 040904B0 or query all blocks which starts with 0409 and choose at least one and maybe print a warning when there is no such block.

The side-effect of this change could be that someone already shipped there app on Windows with a non 040904e4 block and already stored data into the roaming directory directly.

Greetings Michael

tonka3000 avatar Jun 07 '23 08:06 tonka3000