Old 7th March 2006, 20:51   #1
jaswolf
Junior Member
 
Join Date: Mar 2006
Posts: 3
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?
jaswolf is offline   Reply With Quote
Old 7th March 2006, 20:59   #2
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
You can open it and close it right away with FileOpen and FileClose.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 8th March 2006, 01:20   #3
dandaman32
Senior Member
 
dandaman32's Avatar
 
Join Date: Jan 2005
Location: Look behind you.
Posts: 209
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

ExperienceUI for NSIS | Latest project: Enano CMS
Do not PM me on the Winamp forums, I hardly ever check my messages here; you are more likely to get my attention through the ExperienceUI forum.
dandaman32 is offline   Reply With Quote
Old 8th March 2006, 16:58   #4
jaswolf
Junior Member
 
Join Date: Mar 2006
Posts: 3
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
jaswolf is offline   Reply With Quote
Old 8th March 2006, 18:20   #5
dandaman32
Senior Member
 
dandaman32's Avatar
 
Join Date: Jan 2005
Location: Look behind you.
Posts: 209
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

ExperienceUI for NSIS | Latest project: Enano CMS
Do not PM me on the Winamp forums, I hardly ever check my messages here; you are more likely to get my attention through the ExperienceUI forum.
dandaman32 is offline   Reply With Quote
Old 9th March 2006, 07:31   #6
Jamyn
Junior Member
 
Join Date: Aug 2002
Location: Texas
Posts: 36
Someone has already written a pretty nice function for "touch". This might be interesting to you.
Jamyn is offline   Reply With Quote
Old 9th March 2006, 21:28   #7
jaswolf
Junior Member
 
Join Date: Mar 2006
Posts: 3
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.
jaswolf is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump