Old 9th January 2009, 00:36   #1
GoHa
Junior Member
 
Join Date: Dec 2003
Posts: 20
Send a message via ICQ to GoHa
Decimal Delimiter

When installer shows space required/space availabe it use "." as decimal delimiter. For instance: "Space required 13.1Mb"
It shows "." regardless of system regional settings.

How can I make it use system's decimal delimiter rather then just "."?
GoHa is offline   Reply With Quote
Old 9th January 2009, 00:51   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,165
Is it really that big of a deal?

anyways, there is already a bug report about it http://sourceforge.net/tracker/index...49&atid=373085

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 9th January 2009, 01:01   #3
GoHa
Junior Member
 
Join Date: Dec 2003
Posts: 20
Send a message via ICQ to GoHa
Our QA team reported it, therefore, I have to investigate.

Thanks! Hope it will be fixed sometimes soon.
GoHa is offline   Reply With Quote
Old 9th January 2009, 01:25   #4
Animaether
Major Dude
 
Join Date: Jun 2001
Posts: 1,173
You might be able to set the label text yourself, using SectionGetSize to get the size of a section, adding up for each selected section, and rounding that off to megabytes with decimals - with a comma for a decimal - yourself.. if it's something that can't wait for a fix in NSIS itself
Animaether is offline   Reply With Quote
Old 9th January 2009, 02:52   #5
Egor
Junior Member
 
Join Date: Mar 2003
Location: California, USA
Posts: 37
Yes, I can change label text and can set whatver value I want. But I would be unable to change decimal delimiter in the number.
Egor is offline   Reply With Quote
Old 9th January 2009, 11:45   #6
Animaether
Major Dude
 
Join Date: Jun 2001
Posts: 1,173
Edit: All's well - Here's what I have now...

code:

SetCompress off
!include "MUI.nsh"
!include "WinMessages.nsh"
!include "LogicLib.nsh"

OutFile "c:\testsetup.exe"

Page Components ComponentsPre
!insertmacro MUI_LANGUAGE "English"

Var SpaceReq
SpaceTexts "Space Required: $SpaceReq$\r$\n$\r$\n$\r$\n"

Section "Test" Test
File "c:\windows\system32\wmploc.dll" ; 8,231,936bytes
SectionEnd

Function .onSelChange
; Initialize at zero bytes
StrCpy $0 0

; Add selected sections' sizes
${If} ${SectionIsSelected} ${Test}
SectionGetSize ${Test} $1
IntOp $0 $0 + $1
${EndIf}

InTop $0 $0 * 1024 ; KBytes -> Bytes

; Get MegaBytes
IntOp $1 $0 / 1000000
; Get MegaByte Fraction
IntOp $2 $0 % 1000000
; Only two characters, please (no rounding)
StrCpy $2 $2 2 0


; Same for MebiBytes (yeah, I hate the name, too)
IntOp $3 $0 / 1048576
IntOp $4 $0 % 1048576
StrCpy $4 $4 2 0

; Hey look, a comma and such
StrCpy $SpaceReq "$1,$2MB ($3,$4MiB)"
FunctionEnd

Function ComponentsPre
StrCpy $SpaceReq "Two Billion Bytes!" ; Initial size value
FunctionEnd



For any devs reading, SectionGetSize without the SectionSetSize returns 8039 - I've verified that the correct (7.8something MB) file is what is included in the installer.

Last edited by Animaether; 9th January 2009 at 13:49.
Animaether is offline   Reply With Quote
Old 9th January 2009, 12:41   #7
Joost Verburg
NSIS MUI Dev
 
Join Date: Nov 2001
Posts: 3,717
That is the size in KB.
Joost Verburg is offline   Reply With Quote
Old 9th January 2009, 13:45   #8
Animaether
Major Dude
 
Join Date: Jun 2001
Posts: 1,173
Quote:
Originally posted by Joost Verburg
That is the size in KB.
A-ha. I was thrown off by the help's example for SectionGetSize:
code:

Function .onInit
# increase required size of section 'test' by 100 bytes
SectionGetSize ${test_section_id} $0
IntOp $0 $0 + 100
SectionSetSize ${test_section_id} $0
FunctionEnd


Should read kbytes, then?

I'll adjust my post above - should be a simple mult by 1024 (presuming KiB and not KB)?
Edit: Yes - and done.
Animaether is offline   Reply With Quote
Old 9th January 2009, 14:04   #9
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
Keep in mind that using IntOp only works up to 2GB of required space. To be sure your code works for future projects, you might consider using the math plugin:

PHP Code:
    Math::Script 'r1 = ff(f($SPACENEEDED)/1048576,17); #[r1 > 999, r1 = ff(r1/1024,17) + "GB", r1 = r1 + "MB"]' 
I'm not sure if the math plugin uses the system's decimal sign, you might have to replace it in the output string manually.


Edit: Wait, I think I'm talking bullshit. Size in kilobytes, and all. >__<
MSG is offline   Reply With Quote
Old 9th January 2009, 18:26   #10
GoHa
Junior Member
 
Join Date: Dec 2003
Posts: 20
Send a message via ICQ to GoHa
The "required size" output on standard dialog constist of "LABEL" and "NUMBER":
"Required Space" "8.3MB"
Left part can be set as a string. OK.
Right part can be set only as a number. There are no way to change the format of the number. You cannot delete this number from the dialog and only left the label (wich can be edited as shown above).
GoHa is offline   Reply With Quote
Old 9th January 2009, 18:49   #11
Animaether
Major Dude
 
Join Date: Jun 2001
Posts: 1,173
er? have you tried the above code? That should replace the label and number; which should be the exact same control. Perhaps you're using a different UI, though? my example uses MUI
Animaether is offline   Reply With Quote
Old 9th January 2009, 19:55   #12
GoHa
Junior Member
 
Join Date: Dec 2003
Posts: 20
Send a message via ICQ to GoHa
deleted
GoHa is offline   Reply With Quote
Old 10th January 2009, 01:43   #13
GoHa
Junior Member
 
Join Date: Dec 2003
Posts: 20
Send a message via ICQ to GoHa
Thanks. Now I got it. Yes, it works.
However, we decided to defer this issue for now, and wait for NSIS team fix, as it require to many code for such a small issue (we also need to show space available... bla-bla-bla).
GoHa is offline   Reply With Quote
Old 10th January 2009, 02:01   #14
Animaether
Major Dude
 
Join Date: Jun 2001
Posts: 1,173
fair 'nuff
Animaether 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