How add "version.txt" Version File by Command Line or by resources.res using dmd.exe

Marcone marcone at email.com
Sun Dec 8 22:22:16 UTC 2019


On Sunday, 8 December 2019 at 20:56:05 UTC, mipri wrote:
> On Sunday, 8 December 2019 at 20:50:05 UTC, Marcone wrote:
>> I want to add version to my program.
>> I have configurated my version file "version.txt",  but I dont 
>> know how link this file to my program. If Need spec file, 
>> please send the exemple code of spec. Or is is possible add 
>> version file by dmd command line or resources. Thank you.
>
> I'm not sure I know what you're asking, but maybe this is
> the answer.
>
> In version.txt:
>
>   0.1.0 - a version example
>
> In version.d:
>
>   import std.string : chomp;
>
>   immutable Version = import("version.txt").chomp;
>
>   void main() {
>       import std.stdio : writeln;
>       writeln("Version: ", Version);
>   }
>
> To compile and run with both files in the current directory:
>
>   dmd -J. -run version
>
> With output:
>
>   Version: 0.1.0 - a version example
>
> The corresponding dub setting is probably stringImportPaths

How can I add this "version.txt":

VSVersionInfo(
     ffi=FixedFileInfo(
         filevers=(1,0,0,0), # Version Number.
         prodvers=(1,0,0,0), # Version Number.
         mask=0x3f,
         flags=0x0,
         OS=0x40004,
         fileType=0x1,
         subtype=0x0,
         date=(0, 0)
     ),
     kids=[
     StringFileInfo(
         [
         StringTable(
             '040904b0',
             [
             #StringStruct('Comments', ''), # Description 
Information.
             #StringStruct('CompanyName', ''), # Description 
Information.
             StringStruct('FileDescription', 'Programa'), # 
Description Information.
             StringStruct('FileVersion', ' 1,0,0'), # Version 
Number.
             #StringStruct('InternalName', ''), # Description 
Information.
             StringStruct('LegalCopyright', 'Copyright 2019 
Marcone'), # Description Information.
             #StringStruct('LegalTrademarks', ''), # Description 
Information.
             #StringStruct('OriginalFilename', ''), # Description 
Information.
             StringStruct('ProductName', 'Programa'), # 
Description Information.
             StringStruct('ProductVersion', ' 1,0,0'), # Version 
Number.
             ]
         )
         ]
     ),
     VarFileInfo(
         [
         VarStruct('Translation', [1033, 1200])
         ]
     )
     ]
)


More information about the Digitalmars-d-learn mailing list