Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   NSIS Discussion (http://forums.winamp.com/forumdisplay.php?f=65)
-   -   NSIS and Touch (http://forums.winamp.com/showthread.php?t=240213)

jaswolf 7th March 2006 20:51

NSIS and Touch
 
I'm a novice at this and am trying touch a single file when executing the installer I'm creating using NSIS. I want this single file to show the install date as the "last modified" so that I know when it was installed (I don't want to use SetDateSave because that changes the date on all the files). Has anyone had success doing this sort of thing?

kichik 7th March 2006 20:59

You can open it and close it right away with FileOpen and FileClose.

dandaman32 8th March 2006 01:20

Quote:

You can open it and close it right away with FileOpen and FileClose.
Make sure to make the open mode "a" (as opposed to "r" or "w") because "r" will only open the file for reading, and "w" will wipe the file clean.

code:
FileOpen $0 "$INSTDIR\replace_with_file.name" a
FileClose $0



-dandaman32

jaswolf 8th March 2006 16:58

I try putting that in a fuction and get a 'install function "TouchFile" not referenced - zeroing code (0-4) out
' error.

Function TouchFile
FileOpen $0 $INSTDIR\test.txt a
FileClose $0
FunctionEnd

dandaman32 8th March 2006 18:20

Here's what you're looking for:
code:

Function TouchFile
Exch $0
Push $1
FileOpen $1 $0 a
FileClose $1
Pop $1
Exch $0
FunctionEnd


...and later, in your sections...
code:

Push "$INSTDIR\text.txt"
Call TouchFile



-dandaman32

Jamyn 9th March 2006 07:31

Someone has already written a pretty nice function for "touch". This might be interesting to you.

jaswolf 9th March 2006 21:28

Had tried that Touch function before w/o success, but went back an made it work pretty well with using under a "Function .onGUIEnd" section. Thanks for all the input.


All times are GMT. The time now is 17:46.

Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.