Autoreate EXE with version numbers in filename?

Everything else that doesn't fall into one of the other PB categories.
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4749
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Autoreate EXE with version numbers in filename?

Post by Fangbeast »

When I create an executable, instead of the compiler asking me for the filename, is there some way it could get that data from the constants in compile options?

Data such as Product name, product version, Compile count, build count etc so it would look something like this when compiled:

Muffins v2.00.6.1.exe

Instead of me having to remember and rename it manually. This way, I'd be issuing updates each time with the correct build data in the filename.

I've filled in all the detail under compiler options, now I just want to make i easier on myself:):)

Hmm, must be too hard:)
Amateur Radio, D-STAR/VK3HAF
User avatar
Lunasole
Addict
Addict
Posts: 1091
Joined: Mon Oct 26, 2015 2:55 am
Location: UA
Contact:

Re: Autoreate EXE with version numbers in filename?

Post by Lunasole »

Well that's possible to do by simple IDE tool. I.e. WILL be possible, if only IDE send some data about executable version to a tool (currently it doesn't).
So I'd rather require version info transfer through tool environment variables ^^

Code: Select all

EnableExplicit

; compile this and add to IDE tools with "After Create Executable" trigger
Define ExeFile$ = GetEnvironmentVariable("PB_TOOL_Executable")

; here it is possible to rename your executable as you wish
If FileSize(ExeFile$) >= 0
	RenameFile(ExeFile$, GetPathPart(ExeFile$) + "new_exe_name" + "." + GetExtensionPart(ExeFile$))
EndIf
Anyway, you can somehow else extract version data (by getting it from exe directly using WINAPI or some code to read PE header, for example), then use it for renaming like you described
"W̷i̷s̷h̷i̷n̷g o̷n a s̷t̷a̷r"
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4749
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Re: Autoreate EXE with version numbers in filename?

Post by Fangbeast »

WILL be possible, if only IDE send some data about executable version to a tool (currently it doesn't).
Pity, would be very useful to spit out properly named exe's.
Anyway, you can somehow else extract version data (by getting it from exe directly using WINAPI or some code to read PE header, for example), then use it for renaming like you described
Guess anything is possible but didn't know that things like compile count etc, would be stored in the header.

Will go searching.
Amateur Radio, D-STAR/VK3HAF
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4749
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Re: Autoreate EXE with version numbers in filename?

Post by Fangbeast »

Found something in DroopyLib but no compile count info. And there is some sort of error with a global that I don't follow so the ide would be better to return that info for a tool.
Amateur Radio, D-STAR/VK3HAF
User avatar
Lunasole
Addict
Addict
Posts: 1091
Joined: Mon Oct 26, 2015 2:55 am
Location: UA
Contact:

Re: Autoreate EXE with version numbers in filename?

Post by Lunasole »

Fangbeast wrote: Guess anything is possible but didn't know that things like compile count etc, would be stored in the header.
There is a token %COMPILECOUNT for 'version info' compiler settings, so generally possible read it all from header.
Alternatively maybe it is possible to read all that data from .pb / .pbp files directly.
Hope this helps somehow, I'd like to code such a tool, but not needing it myself and a bit busy recently to go with it deeper
"W̷i̷s̷h̷i̷n̷g o̷n a s̷t̷a̷r"
User avatar
skywalk
Addict
Addict
Posts: 4005
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: Autoreate EXE with version numbers in filename?

Post by skywalk »

If you don't mind a date based version system...?
I use these to autogenerate my versions at compile for simple tools.
Place this text at the bottom of your main source file if you store config data in source files?

For main apps, I use a resource file which I autofill the version data.

Code: Select all

; IDE Options = PureBasic 5.60 Beta 2 (Windows - x64)
; CursorPosition = 55
; FirstLine = 69
; Folding = ------------------------------------------------v-------------------9---------------
; EnableThread
; EnableXP
; UseIcon = C:\dev\my.ico
; Executable = ..\..\myapp.exe
; CurrentDirectory = C:\dev\myapp\
; CompileSourceDirectory
; EnablePurifier = 1,1,1,1
; IncludeVersionInfo
; VersionField0 = %yy,%mm,%dd,0
; VersionField1 = %yy,%mm,%dd,0
; VersionField2 = My Co
; VersionField3 = MyApp
; VersionField4 = %yy.%mm.%dd
; VersionField5 = %yy.%mm.%dd
; VersionField6 = What my app does.
; VersionField7 = My app
; VersionField9 = My co
; VersionField10 = My co
; VersionField13 = skywalk@myco.com
; VersionField14 = www.myco.com
; VersionField17 = 0409 English (United States)
; EnableUnicode
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
Post Reply