Old 6th September 2003, 12:24   #1
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Strange happenings between 2 installers

I have made a simple installer to get the file size (FileSizeNew) of say blah.bsp on my hard drive, then write the value to an ini file which I can store on the web.

A typical value is 5036424.

Now, my main installer downloads the ini file from the web, then gets the file size of that same file (blah.bsp) on the users' hard drive (in this case, the exact same blah.bsp on my hard drive).

However, the value is always 5036425 and not 5036424.
It seems to add 1 on even though it is exactly the same file that my installer is getting the file size from.

Right now I am taking 1 from the file size to get it to work, but this shouldn't be happening at all.

This is not just happening to the one bsp file, but for all the files.
Could it be because of different installer styles (the installer to first get the file sizes is only a basic one with just an instfiles page)

-Stu
Afrow UK is offline   Reply With Quote
Old 6th September 2003, 12:27   #2
Joost Verburg
NSIS MUI Dev
 
Join Date: Nov 2001
Posts: 3,717
Isn't it a webserver related issue (UNIX/DOS newlines etc.)?
Joost Verburg is offline   Reply With Quote
Old 6th September 2003, 12:29   #3
Brummelchen
Major Dude
 
Join Date: May 2003
Posts: 681
not a solution - but i understood it this way:

prog gets size from file > ini
ini uploaded to web
prog gets ini from web > size = size+1

So ini has changed?

Greets, Brummelchen
Brummelchen is offline   Reply With Quote
Old 6th September 2003, 12:30   #4
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
No, the value written to my ini file on my hard drive is always 1 less even before upload.

-Stu
Afrow UK is offline   Reply With Quote
Old 6th September 2003, 12:55   #5
Brummelchen
Major Dude
 
Join Date: May 2003
Posts: 681
So

>> prog gets size from file > ini
(1st step)

writes the wrong size?
routines are same? 2 different progs?

Greets, Brummelchen
Brummelchen is offline   Reply With Quote
Old 6th September 2003, 16:15   #6
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
That is correct.
Same path, two different progs.
Either the 1st prog is getting it wrong, or the main prog is.

-Stu
Afrow UK is offline   Reply With Quote
Old 6th September 2003, 17:25   #7
Brummelchen
Major Dude
 
Join Date: May 2003
Posts: 681
is it possible to get your code or codesnippets?

Greets, Brummelchen
Brummelchen is offline   Reply With Quote
Old 6th September 2003, 18:39   #8
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
To write the file sizes to my ini (txt) file:
code:
Section ""
FileOpen $R0 "C:\progra~1\nsis\Dev\ddayupdater\gfs\newmaps.lst" r
loop:
ClearErrors
FileRead $R0 $R1
IfErrors done
Push $R1
Call TrimNewLines
Pop $R1
StrCmp $R1 "" done
StrCmp $R1 eof done
Push "C:\quake2\dday\maps\$R1.bsp"
Call FileSizeNew
Pop $0
WriteINIStr "C:\progra~1\nsis\Dev\ddayupdater\du_objects.txt" "New map versions" "$R1.bsp" "$0"
FileRead $R0 $0
Push $0
Call TrimNewLines
Pop $0
WriteINIStr "C:\progra~1\nsis\Dev\ddayupdater\du_objects.txt" "New map versions" "$R1.bsp-zip" "$0"
Goto loop
done:
FileClose $R0
SectionEnd



Then in my main installer, I read the values again from the downloaded du_objects.txt and compare:
code:
ReadINIStr $1 "$TEMP\ddayupdates\objects.du" "New map versions" "$R3"
StrCmp $1 "" loop_maplist

ReadINIStr $2 "$TEMP\ddayupdates\objects.du" "New map versions" "$R3-zip"
StrCmp $2 $R0 0 loop_maplist

Push "$EXEDIR\maps\$R3"
Call FileSizeNew
Pop $2
StrCmp $1 $2 loop_maplist



du_objects.txt is here: http://myweb.tiscali.co.uk/imker/dda...du_objects.txt

newmaps.lst is attached as newmaps.txt

-Stu
Attached Files
File Type: txt newmaps.txt (531 Bytes, 138 views)
Afrow UK is offline   Reply With Quote
Old 6th September 2003, 19:23   #9
Brummelchen
Major Dude
 
Join Date: May 2003
Posts: 681
code:
FileRead $R0 $0
Push $0

Call TrimNewLines
Pop $0



Somewhere between these lines...

"TrimNewLines" ?

i often control vars with a messagebox

eg.
MessageBox MB_ICONINFORMATION|MB_OK "'$R0', '$0'"

So i can see quickly whats going wrong and where - i had such a situation here.

hmm - a bug in "FileRead $R0 $0" ?

Greets, Brummelchen
Brummelchen is offline   Reply With Quote
Old 6th September 2003, 20:02   #10
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Try calling FileSizeNew without any other things on the script with those two computers you were testing on. Though I can't see a reason it might fail, you should try and make sure that's not the reason.

Also make sure the files are really the same size on both computers... Who knows, you might have some program/virus that tacks another byte on the end.

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 6th September 2003, 20:17   #11
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Quote:
Originally posted by kichik
Try calling FileSizeNew without any other things on the script with those two computers you were testing on. Though I can't see a reason it might fail, you should try and make sure that's not the reason.

Also make sure the files are really the same size on both computers... Who knows, you might have some program/virus that tacks another byte on the end.
The bsps are the same, they are the same bsps on the same computer.
The computers are the same - I am testing on one.

-Stu
Afrow UK 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