PDA

View Full Version : Build Time Version Updater


Centauri Soldier
12-11-2008, 05:12 AM
Some time ago I recall seeing a post in which someone was asking for build version tallying. Well, here's what I came up with...hope it helps.

BuildTime = {};

--======================>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
function BuildTime.VersionUpdate(sAFVersionFilePath) --[[>>
<< Updates the build version of your program each >>
<< time it runs. Be sure to disable it before compiling. >>
<<<<<<<<<<<<<<<<<<<<<==================================--]]
if not File.DoesExist(sAFVersionFilePath) then
tAFProgramVersion = {};
tAFProgramVersion[1] = 0;
tAFProgramVersion[2] = 0;
tAFProgramVersion[3] = 0;
tAFProgramVersion[4] = 0;
TextFile.WriteFromTable(sAFVersionFilePath, tAFProgramVersion, false);
end

tAFProgramVersion = TextFile.ReadToTable(sAFVersionFilePath);

tAFProgramVersion[4] = tAFProgramVersion[4] + 1;

if tAFProgramVersion[4] > 9 then
tAFProgramVersion[4] = 0;
tAFProgramVersion[3] = tAFProgramVersion[3] + 1;

if tAFProgramVersion[3] > 9 then
tAFProgramVersion[3] = 0;
tAFProgramVersion[2] = tAFProgramVersion[2] + 1;

if tAFProgramVersion[2] > 9 then
tAFProgramVersion[2] = 0;
tAFProgramVersion[1] = tAFProgramVersion[1] + 1;
end

end

end

TextFile.WriteFromTable(sAFVersionFilePath, tAFProgramVersion, false);

sAFCurrentBuildVersion = tAFProgramVersion[1].."."..tAFProgramVersion[2].."."..tAFProgramVersion[3].."."..tAFProgramVersion[4];

return sAFCurrentBuildVersion;

-->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
end--|||||||||||||END FUNCTION|||||||||||||||||
-->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

TJ_Tigger
12-11-2008, 08:46 AM
Thanks,

I was asking for this feature to be built into AMS. It would be nice to know how many times I have built the project (I guess that would include previewing the project for testing). I have created a similar script to keep track of how many times a program ran. I even went so far as to put a check into the function that would verify that it was being run on my test machine (MAC address) and that the tracking file exists so it should actually increment the build number.

Tigig

Centauri Soldier
12-11-2008, 01:32 PM
Good idea, I just rely on the old fashion IS THERE / IS NOT THERE code placement for determining if it's build-time or run-time lol.