Archive: How about file time of installed files... ?


How about file time of installed files... ?
Hello,

looked up in the forum already, either i'm blind or unable to search :)

I'm new to NSIS installer, took an example and built my own installer around it. Everything works great after some days. Good piece of software!

I use the file time of the installed files as a hint for the version of the software:
e.g. files of V 2.05.27 get a filetime of 05:27 So in case of service the version can easily be seen. The date is set to the release date of the software.

The way i do it: Copy all files in the target folder and then build the installer, in which i execute filetime.exe, a simple command line tool to set the desired timestamp. At that point it's all ok, the files get the desired time stamp and it is also unchanged after building the installer - as it is supposed to.

But:
Finally the installed files have a timestamp of e.g. 04:27 instead of 05:27. Seems to be something around daylight time...


For the last 10 years i've used an old version of Install Shield without having this timestamp problem. There i also have set the time stamp with filetime.exe

Any idea how to keep the time stamp of the installed files untouched?

Did not find anything in the users manual and not here in the forum.

Regards, jenserl


PS: The OS is WinXP


Wow, no one any idea... ?

:confused: ooops...


You could include filetime.exe in the installer and set the timestamp after the files have been extracted on the final system.

But the timestamp will still vary by an hour when the system switches to/from daylight time. Even with InstallShield it has been doing that all along, you've just not noticed it.


Also, your method is not very well suited to your goals. Filetimes are subject to change by influence from the user.

You're much better off putting the fileversion inside the files themselves.


@ demiller9:
Thank you for the hint with setting filetime after extraction.
BUT fiddling around with this, i didn't find a way to have this done.

I wrote the function:

Function .onInstSuccess
MessageBox MB_OK "Pre File Time!""
!execute "C:\WINDOWS\filetime.exe C:\Program Files\MyApp\MyApp.exe -t 30062011080910"
MessageBox MB_OK "After File Time"
FunctionEnd


The two MeesageBoxes show up, but the timestamp of MyApp.exe is unchanged.
No error message in the MakeNSISW compiler,
no error running the installer

I also tried to place the "!execuite..." line inside, at the end, of the Section "install", but nothing happened also.

What I'm doing wrong? Maybe it's wrong just that I'm new to NSIS ... :-)



Yes, i know about daylight problem, but it never showed up the last 8 years i was using the pretty old InstallShield V2.12 (62)...

@MSG:
Yes, there is version information in the executable.
And i know about those users kidding around in the applications files, too ;-)
But, if they do something wrong, its their machine not running and their prodution stopping.
So, most of the useres dont do anything with the application directly, because finally they will pay the service staff and the loss of production :D


As i wrote in the initial posting: That timestamp is just a simple way to provide version info for our service staff. The application itself is not depending on that info. And, i repeat myself: Its all ok with that pretty old InstallShield.

So i would like to use this way of help further on...
If not possible, ok, forget abot it.

Regards, Jenserl


Use single and double quotes as here:
http://nsis.sourceforge.net/Docs/Chapter5.html#5.1.9


@ jpderuiter:
Sorry, this did not help also...

Tried also the !system command, no change :-(


During compile time, i set the datetime of the source files with:

!execute "${MYTOOLSPATH}\${FILETIMEAPP} ${SRCPATH_APP}\*.* -t ${APP_DATETIME}"

and this works as supposed...


jenserl


!execute is a compile time command, you want the execution time command ExecWait (or one of the plug-in equivalents like nsExec::Exec to avoid a console window).


There's also the Time plugin.
But if your exe already contains version info, why can't your service guy just hover the mouse over it? No offence, but it's like your philosophy is "let's do it the complicated and unreliable way".


@demiller9
Oh yes, true. But with all the Exec... Commands i could not get datetime.exe to work. It seemed to run without error but did not change anything. Seems i still do basic things wrong... :-( Tried it in section "install" after the File commands, tried it in .onInstSuccess - nothing happened.

@aerDNA
Anyway, this helped. Thank you very much, it brought the solution. File datetime changing now as desired.


But, demiller9, you are right :up:, depending on daylight time, the displayed filetime is adjusted. Either i really did not have to use this little helper or it just happened that daylight time was correct everytime we looked at the files :-) :rolleyes:

OK, that all brought me a bit deeper into NSIS and i learned a lot about the way to do things. Even therefore i thank you all very much for your help.

So lets close this thread now. Have a nice time,
Jenserl


You do realize you haven't solved the post-install DST switch problem? And you're not going to since you're working with local time. UTC you'd have to get programmatically, which defeats your purpose. Suit yourself.


Hey aerDNA,

yes, i realized that the "problem" is not solved. But it's behaving the same now as with the 8 years old solution before. And i think i can live with that also the next 8 years... :D

As i wrote above, it's only a little helper and rarely used, because...
- as long as the application is running, the version is shown in the title line. So, no problem.
- if not and a service guy is around, he knows to look up the version in the properties. So, no problem also.
- Only if it happens that i've to talk with a machine operator (their main knowledge is how to use hammer and wrench...:)) AND the app refusing to run, it's good to have a simple way to find out about the version. Next, the files' date is set to the release date of the version, at least looking up the release date in my documents shows the correct version. Mostly its enough already to see that all the application's files have same version and are not mangled by some creative users. For that, even a time shifted timestamp is ok, as long as all files have the same...

The way it was and is now will fit the requirements...

But back to your suggestion with UTC:
Did you mean to set the PC's time to UTC and disable DST switching? Or setting the file time as UTC time? I i've tried the second with the Time plugin, but of course with DST change also the displayed file time changed - as expected...

Well, a new installer was on my ToDo list for longer time already. Since there was a delay in the mechanic part of the current project, i've found enough time now to do this. The new installer now is doing what is expected: Its installing an application... :up: :-) For me, the rest is more or less "a little cosmetic" problem. And that all suits my needs now...

Best regards and thank you for your help,
Jenserl