Archive: Strange happenings between 2 installers


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 :cry:


Isn't it a webserver related issue (UNIX/DOS newlines etc.)?


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?


No, the value written to my ini file on my hard drive is always 1 less even before upload.

-Stu


So

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

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


That is correct.
Same path, two different progs.
Either the 1st prog is getting it wrong, or the main prog is.

-Stu


is it possible to get your code or codesnippets?


To write the file sizes to my ini (txt) file:

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:
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

 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" ?

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.


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