Last change
on this file since 24567 was 2601, checked in by ulf, 18 years ago |
very first (alpha) version of an osm Win32 installer
|
File size:
1.4 KB
|
Line | |
---|
1 | ;
|
---|
2 | ; Write to INI style file with no section headings
|
---|
3 | ;
|
---|
4 | ; http://nsis.sourceforge.net/Write_to_INI_style_file_with_no_section_headings
|
---|
5 | ;
|
---|
6 | ; some more at: http://nsis.sourceforge.net/Category:INI%2C_CSV_%26_Registry_Functions
|
---|
7 |
|
---|
8 | Function WriteINIStrNS
|
---|
9 | Exch $R0 ; new value
|
---|
10 | Exch
|
---|
11 | Exch $R1 ; key
|
---|
12 | Exch 2
|
---|
13 | Exch $R2 ; ini file
|
---|
14 | Exch 2
|
---|
15 | Push $R3
|
---|
16 | Push $R4
|
---|
17 | Push $R5
|
---|
18 | Push $R6
|
---|
19 | Push $R7
|
---|
20 | Push $R8
|
---|
21 | Push $R9
|
---|
22 |
|
---|
23 | StrCpy $R9 0
|
---|
24 |
|
---|
25 | FileOpen $R3 $R2 r
|
---|
26 | GetTempFileName $R4
|
---|
27 | FileOpen $R5 $R4 w
|
---|
28 |
|
---|
29 | LoopRead:
|
---|
30 | ClearErrors
|
---|
31 | FileRead $R3 $R6
|
---|
32 | IfErrors End
|
---|
33 |
|
---|
34 | StrCpy $R7 -1
|
---|
35 | LoopGetVal:
|
---|
36 | IntOp $R7 $R7 + 1
|
---|
37 | StrCpy $R8 $R6 1 $R7
|
---|
38 | StrCmp $R8 "" LoopRead
|
---|
39 | StrCmp $R8 = 0 LoopGetVal
|
---|
40 |
|
---|
41 | StrCpy $R8 $R6 $R7
|
---|
42 | StrCmp $R8 $R1 0 +4
|
---|
43 |
|
---|
44 | FileWrite $R5 "$R1=$R0$\r$\n"
|
---|
45 | StrCpy $R9 1
|
---|
46 | Goto LoopRead
|
---|
47 |
|
---|
48 | FileWrite $R5 $R6
|
---|
49 | Goto LoopRead
|
---|
50 |
|
---|
51 | End:
|
---|
52 | StrCmp $R9 1 +2
|
---|
53 | FileWrite $R5 "$R1=$R0$\r$\n"
|
---|
54 |
|
---|
55 | FileClose $R5
|
---|
56 | FileClose $R3
|
---|
57 |
|
---|
58 | SetDetailsPrint none
|
---|
59 | Delete $R2
|
---|
60 | Rename $R4 $R2
|
---|
61 | SetDetailsPrint both
|
---|
62 |
|
---|
63 | Pop $R9
|
---|
64 | Pop $R8
|
---|
65 |
|
---|
66 | Pop $R7
|
---|
67 | Pop $R6
|
---|
68 | Pop $R5
|
---|
69 | Pop $R4
|
---|
70 | Pop $R3
|
---|
71 | Pop $R2
|
---|
72 | Pop $R1
|
---|
73 | Pop $R0
|
---|
74 | FunctionEnd
|
---|
75 |
|
---|
76 | !define WriteINIStrNS "!insertmacro WriteINIStrNS"
|
---|
77 | !macro WriteINIStrNS Var File Key Value
|
---|
78 | Push "${File}"
|
---|
79 | Push "${Key}"
|
---|
80 | Push "${Value}"
|
---|
81 | Call WriteINIStrNS
|
---|
82 | Pop "${Var}"
|
---|
83 | !macroend
|
---|
84 |
|
---|
85 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.