Show More
@@ -68,79 +68,42 b' begin' | |||||
68 | for d := 0 to GetArrayLength(pathdir)-1 do begin |
|
68 | for d := 0 to GetArrayLength(pathdir)-1 do begin | |
69 | updatepath := true; |
|
69 | updatepath := true; | |
70 |
|
70 | |||
71 | // Modify WinNT path |
|
71 | // Get current path, split into an array | |
72 | if UsingWinNT() = true then begin |
|
72 | RegQueryStringValue(regroot, regpath, 'Path', oldpath); | |
73 |
|
73 | oldpath := oldpath + ';'; | ||
74 | // Get current path, split into an array |
|
74 | i := 0; | |
75 | RegQueryStringValue(regroot, regpath, 'Path', oldpath); |
|
|||
76 | oldpath := oldpath + ';'; |
|
|||
77 | i := 0; |
|
|||
78 |
|
||||
79 | while (Pos(';', oldpath) > 0) do begin |
|
|||
80 | SetArrayLength(pathArr, i+1); |
|
|||
81 | pathArr[i] := Copy(oldpath, 0, Pos(';', oldpath)-1); |
|
|||
82 | oldpath := Copy(oldpath, Pos(';', oldpath)+1, Length(oldpath)); |
|
|||
83 | i := i + 1; |
|
|||
84 |
|
75 | |||
85 | // Check if current directory matches app dir |
|
76 | while (Pos(';', oldpath) > 0) do begin | |
86 | if pathdir[d] = pathArr[i-1] then begin |
|
77 | SetArrayLength(pathArr, i+1); | |
87 | // if uninstalling, remove dir from path |
|
78 | pathArr[i] := Copy(oldpath, 0, Pos(';', oldpath)-1); | |
88 | if IsUninstaller() = true then begin |
|
79 | oldpath := Copy(oldpath, Pos(';', oldpath)+1, Length(oldpath)); | |
89 | continue; |
|
80 | i := i + 1; | |
90 | // if installing, flag that dir already exists in path |
|
|||
91 | end else begin |
|
|||
92 | updatepath := false; |
|
|||
93 | end; |
|
|||
94 | end; |
|
|||
95 |
|
81 | |||
96 |
|
|
82 | // Check if current directory matches app dir | |
97 |
|
|
83 | if pathdir[d] = pathArr[i-1] then begin | |
98 | newpath := pathArr[i-1]; |
|
84 | // if uninstalling, remove dir from path | |
|
85 | if IsUninstaller() = true then begin | |||
|
86 | continue; | |||
|
87 | // if installing, flag that dir already exists in path | |||
99 | end else begin |
|
88 | end else begin | |
100 | newpath := newpath + ';' + pathArr[i-1]; |
|
89 | updatepath := false; | |
101 | end; |
|
90 | end; | |
102 | end; |
|
91 | end; | |
103 |
|
92 | |||
104 | // Append app dir to path if not already included |
|
93 | // Add current directory to new path | |
105 | if (IsUninstaller() = false) AND (updatepath = true) then |
|
94 | if i = 1 then begin | |
106 |
newpath := |
|
95 | newpath := pathArr[i-1]; | |
107 |
|
||||
108 | // Write new path |
|
|||
109 | RegWriteStringValue(regroot, regpath, 'Path', newpath); |
|
|||
110 |
|
||||
111 | // Modify Win9x path |
|
|||
112 | end else begin |
|
|||
113 |
|
||||
114 | // Convert to shortened dirname |
|
|||
115 | pathdir[d] := GetShortName(pathdir[d]); |
|
|||
116 |
|
||||
117 | // If autoexec.bat exists, check if app dir already exists in path |
|
|||
118 | aExecFile := 'C:\AUTOEXEC.BAT'; |
|
|||
119 | if FileExists(aExecFile) then begin |
|
|||
120 | LoadStringsFromFile(aExecFile, aExecArr); |
|
|||
121 | for i := 0 to GetArrayLength(aExecArr)-1 do begin |
|
|||
122 | if IsUninstaller() = false then begin |
|
|||
123 | // If app dir already exists while installing, skip add |
|
|||
124 | if (Pos(pathdir[d], aExecArr[i]) > 0) then |
|
|||
125 | updatepath := false; |
|
|||
126 | break; |
|
|||
127 | end else begin |
|
|||
128 | // If app dir exists and = what we originally set, then delete at uninstall |
|
|||
129 | if aExecArr[i] = 'SET PATH=%PATH%;' + pathdir[d] then |
|
|||
130 | aExecArr[i] := ''; |
|
|||
131 | end; |
|
|||
132 | end; |
|
|||
133 | end; |
|
|||
134 |
|
||||
135 | // If app dir not found, or autoexec.bat didn't exist, then (create and) append to current path |
|
|||
136 | if (IsUninstaller() = false) AND (updatepath = true) then begin |
|
|||
137 | SaveStringToFile(aExecFile, #13#10 + 'SET PATH=%PATH%;' + pathdir[d], True); |
|
|||
138 |
|
||||
139 | // If uninstalling, write the full autoexec out |
|
|||
140 | end else begin |
|
96 | end else begin | |
141 | SaveStringsToFile(aExecFile, aExecArr, False); |
|
97 | newpath := newpath + ';' + pathArr[i-1]; | |
142 | end; |
|
98 | end; | |
143 | end; |
|
99 | end; | |
|
100 | ||||
|
101 | // Append app dir to path if not already included | |||
|
102 | if (IsUninstaller() = false) AND (updatepath = true) then | |||
|
103 | newpath := newpath + ';' + pathdir[d]; | |||
|
104 | ||||
|
105 | // Write new path | |||
|
106 | RegWriteStringValue(regroot, regpath, 'Path', newpath); | |||
144 | end; |
|
107 | end; | |
145 | end; |
|
108 | end; | |
146 |
|
109 | |||
@@ -207,13 +170,6 b' begin' | |||||
207 | end; |
|
170 | end; | |
208 |
|
171 | |||
209 | function NeedRestart(): Boolean; |
|
172 | function NeedRestart(): Boolean; | |
210 | var |
|
|||
211 | taskname: String; |
|
|||
212 | begin |
|
173 | begin | |
213 | taskname := ModPathName; |
|
174 | Result := False; | |
214 | if IsTaskSelected(taskname) and not UsingWinNT() then begin |
|
|||
215 | Result := True; |
|
|||
216 | end else begin |
|
|||
217 | Result := False; |
|
|||
218 | end; |
|
|||
219 | end; |
|
175 | end; |
General Comments 0
You need to be logged in to leave comments.
Login now