Skip to content

package_info_plus for windows returns invalid string #182

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

Closed
Farer opened this issue Mar 11, 2021 · 7 comments
Closed

package_info_plus for windows returns invalid string #182

Farer opened this issue Mar 11, 2021 · 7 comments
Labels
bug Something isn't working Hacktoberfest Issues taking part in Hacktoberfest package_info_plus stuff related to package_info_plus

Comments

@Farer
Copy link

Farer commented Mar 11, 2021

image

As you see above it returns invalid string.
I guessed that is blank string.
Buy it's not blank.
So I can't parse it as int.
Could you fix it ?

@Farer Farer added the bug Something isn't working label Mar 11, 2021
@p3root
Copy link

p3root commented Mar 16, 2021

It also returns always just "1.0.0 ". I have a different version number in my pubspec file

@narumi147
Copy link
Contributor

narumi147 commented Apr 14, 2021

The last char is \x000. So should all values be trimmed in getValue?


can anyone have a quick fix on it?

The \x000 may be cause by such code \0 in generated windows/runner/Runner.rc

BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "040904e4"
        BEGIN
            VALUE "CompanyName", "com.example" "\0"
            VALUE "FileDescription", "A new Flutter project." "\0"
            VALUE "FileVersion", VERSION_AS_STRING "\0"
            VALUE "InternalName", "example" "\0"
            VALUE "LegalCopyright", "Copyright (C) 2021 com.example. All rights reserved." "\0"
            VALUE "OriginalFilename", "example.exe" "\0"
            VALUE "ProductName", "example" "\0"
            VALUE "ProductVersion", VERSION_AS_STRING "\0"
        END
    END
    BLOCK "VarFileInfo"
    BEGIN
        VALUE "Translation", 0x409, 1252
    END
END

BTW @p3root flutter hasn't implement generating version for exe from pubspec yet, it's not an issue of this plugin

@p3root
Copy link

p3root commented Apr 14, 2021

Any workaroung for that?

@narumi147
Copy link
Contributor

@p3root please tracking flutter/flutter#73652

@narumi147
Copy link
Contributor

@p3root if you want to update exe version, you can edit windows/runner/Runner.rc. Just change the default value for VERSION_AS_NUMBER and VERSION_AS_STRING. This is my current solution before official support. You will need to change it manually every time changing version.

#ifdef FLUTTER_BUILD_NUMBER
#define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER
#else
#define VERSION_AS_NUMBER 1,3,8,33
#endif

#ifdef FLUTTER_BUILD_NAME
#define VERSION_AS_STRING #FLUTTER_BUILD_NAME
#else
#define VERSION_AS_STRING "1.3.8.33"
#endif

The original should be x.y.z and "x.y.z", I add build number after. If you want to use package_info_plus to parse it, you should change 1.3.8.33 to 1.3.8+33 in my example.

@mhadaily
Copy link
Member

duplicate #343

reason: flutter/flutter#73652

@mhadaily mhadaily added the Hacktoberfest Issues taking part in Hacktoberfest label Sep 28, 2021
@fabiancrx
Copy link
Contributor

This issue could be closed and continue tracking at #343 as @mhadaily stated.

@mhadaily mhadaily closed this as completed Apr 3, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 28, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working Hacktoberfest Issues taking part in Hacktoberfest package_info_plus stuff related to package_info_plus
Projects
None yet
Development

No branches or pull requests

5 participants