These patches correct the behavior of the InnoSetup script (some files were not installed, and PATH should *finally* be updated correctly).

I hope that I won't bother you anymore before the 1.3.2 release :-)

Cheers,
Filip

Index: misc/mozart.iss
===================================================================
RCS file: /services/mozart/CVS/mozart/misc/Attic/mozart.iss,v
retrieving revision 1.1.2.3
diff -u -r1.1.2.3 mozart.iss
--- misc/mozart.iss     15 May 2006 11:45:36 -0000      1.1.2.3
+++ misc/mozart.iss     2 Jun 2006 08:03:32 -0000
@@ -1,124 +1,120 @@
-[Setup]
-AppName=Mozart
-; icon: \bin\oz.exe
-AppCopyright=Open-Source system, see www.mozart-oz.org
-AppVerName=Mozart 1.3.1
-AppPublisher=SICS, DFKI, and other parties
-DefaultDirName={pf}\Mozart
-DefaultGroupName=Mozart
-AllowNoIcons=yes
-LicenseFile=LICENSE.rtf
-;InfoBeforeFile=README
-OutputBaseFilename=Mozart-1.3.1
-Compression=lzma
-SolidCompression=yes
-OutputDir=.
-ChangesAssociations=yes
-ChangesEnvironment=yes
-WizardImageFile=MozartSide.bmp
-WizardSmallImageFile=MozartSmall.bmp
-WizardImageBackcolor=$fffff0
-WizardImageStretch=no
-
-[Languages]
-Name: "english"; MessagesFile: "compiler:Default.isl"
-Name: "brazilianportuguese"; MessagesFile: 
"compiler:Languages\BrazilianPortuguese.isl"
-Name: "catalan"; MessagesFile: "compiler:Languages\Catalan.isl"
-Name: "czech"; MessagesFile: "compiler:Languages\Czech.isl"
-Name: "danish"; MessagesFile: "compiler:Languages\Danish.isl"
-Name: "dutch"; MessagesFile: "compiler:Languages\Dutch.isl"
-Name: "finnish"; MessagesFile: "compiler:Languages\Finnish.isl"
-Name: "french"; MessagesFile: "compiler:Languages\French.isl"
-Name: "german"; MessagesFile: "compiler:Languages\German.isl"
-Name: "hungarian"; MessagesFile: "compiler:Languages\Hungarian.isl"
-Name: "italian"; MessagesFile: "compiler:Languages\Italian.isl"
-Name: "norwegian"; MessagesFile: "compiler:Languages\Norwegian.isl"
-Name: "polish"; MessagesFile: "compiler:Languages\Polish.isl"
-Name: "portuguese"; MessagesFile: "compiler:Languages\Portuguese.isl"
-Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"
-Name: "slovak"; MessagesFile: "compiler:Languages\Slovak.isl"
-Name: "slovenian"; MessagesFile: "compiler:Languages\Slovenian.isl"
-
-[Icons]
-Name: "{group}\{cm:UninstallProgram,Mozart}"; Filename: "{uninstallexe}"
-
-[Components]
-Name: "base"; Description: "Base System"; Types: full compact custom; Flags: 
fixed checkablealone
-Name: "base\progint"; Description: "Programming Interface"; Types: full 
custom; Flags: checkablealone
-Name: "docs"; Description: "Documentation"; Types: full custom
-Name: "docs\chm"; Description: "Documentation"; Types: full custom; Flags: 
checkablealone
-Name: "docs\chm\applets"; Description: "Demo Applets"; Types: full custom; 
Flags: checkablealone
-Name: "docs\examples"; Description: "Examples"; Types: full custom; Flags: 
checkablealone
-Name: "contrib"; Description: "Contributions"; Types: full custom; Flags: 
checkablealone
-Name: "contrib\os"; Description: "OS"; Types: full custom; Flags: 
checkablealone
-Name: "contrib\gdbm"; Description: "GDBM"; Types: full custom; Flags: 
checkablealone
-Name: "contrib\regex"; Description: "Regular Expressions"; Types: full custom; 
Flags: checkablealone
-Name: "contrib\ap"; Description: "Application Programming"; Types: full 
custom; Flags: checkablealone
-Name: "contrib\compat"; Description: "Backwards Compatibility"; Types: full 
custom; Flags: checkablealone
-Name: "contrib\doc_c"; Description: "Documentation Processing"; Types: full 
custom; Flags: checkablealone
-Name: "contrib\tk"; Description: "Additional Widgets"; Types: full custom; 
Flags: checkablealone
-Name: "contrib\micq"; Description: "Mozart Instant Messenger"; Types: full 
custom; Flags: checkablealone
-Name: "contrib\directory"; Description: "Directory Service"; Types: full 
custom; Flags: checkablealone
-
-[Files]
-; applets_images
-Source: "cache\x-oz\doc\demo\applets\images\*.*"; DestDir: 
"{app}\cache\x-oz\doc\demo\applets\images" ; Flags: recursesubdirs; Components: 
docs\chm
-; base
-Source: "*.*"; Excludes: "*.iss,*.exe,*~"; DestDir: "{app}"; Components: base
-; bin
-; bin_oz
-; bin_ozengine
-; bin_ozenginew
-Source: "bin\*.*"; DestDir: "{app}\bin"; Components: base
-; cache_xoz_system
-Source: "cache\x-oz\system\*.ozf"; DestDir: "{app}\cache\x-oz\system"; Flags: 
recursesubdirs; Components: base
-Source: "cache\x-oz\system\images\*.xbm"; DestDir:  
"{app}\cache\x-oz\system\images"; Flags: recursesubdirs; Components: base
-Source: "cache\x-oz\system\images\*.jpg"; DestDir:  
"{app}\cache\x-oz\system\images"; Flags: recursesubdirs; Components: base
-; cache_xozlib
-Source: "cache\x-ozlib\*"; DestDir: "{app}\cache\x-ozlib"; Flags: 
recursesubdirs skipifsourcedoesntexist; Components: base
-; contrib_*
-Source: "cache\x-oz\contrib\ap\*.*"; DestDir: "{app}\cache\x-oz\contrib\ap"; 
Flags: skipifsourcedoesntexist recursesubdirs; Components: contrib\ap
-Source: "cache\x-oz\contrib\compat\*.ozf"; DestDir: 
"{app}\cache\x-oz\contrib\compat"; Flags: skipifsourcedoesntexist 
recursesubdirs; Components: contrib\compat
-Source: "cache\x-oz\contrib\directory\*.*"; DestDir: 
"{app}\cache\x-oz\contrib\directory"; Flags: skipifsourcedoesntexist 
recursesubdirs; Components: contrib\directory
-Source: "cache\x-oz\contrib\doc\*.*"; DestDir: "{app}\cache\x-oz\contrib\doc"; 
Flags: skipifsourcedoesntexist recursesubdirs; Components: contrib\doc_c
-Source: "cache\x-oz\contrib\gdbm.*"; DestDir: "{app}\cache\x-oz\contrib"; 
Flags: skipifsourcedoesntexist recursesubdirs; Components: contrib\gdbm
-Source: "cache\x-oz\contrib\micq\*.*"; DestDir: 
"{app}\cache\x-oz\contrib\micq"; Flags: skipifsourcedoesntexist recursesubdirs; 
Components: contrib\micq
-Source: "cache\x-oz\contrib\os\*.*"; DestDir: "{app}\cache\x-oz\contrib\os"; 
Flags: skipifsourcedoesntexist recursesubdirs; Components: contrib\os
-Source: "cache\x-oz\contrib\regex.*"; DestDir: "{app}\cache\x-oz\contrib"; 
Flags: skipifsourcedoesntexist recursesubdirs; Components: contrib\regex
-Source: "cache\x-oz\contrib\tk\*.*"; DestDir: "{app}\cache\x-oz\contrib\tk"; 
Flags: skipifsourcedoesntexist recursesubdirs; Components: contrib\tk
-; convertTextPickle
-Source: "bin\convertTextPickle"; DestDir: "{app}\bin"; DestName: 
"convertTextPickle.exe"; Components: base; Flags: skipifsourcedoesntexist
-; doc
-Source: "doc\Mozart.chm"; DestDir: "{app}\doc"; Components: docs\chm; Flags: 
skipifsourcedoesntexist
-; doc_addons
-Source: "doc\add-ons\README.html"; DestDir: "{app}\doc\add-ons"; Components: 
docs\chm; Flags:skipifsourcedoesntexist
-; doc_demo_applets
-Source: "doc\demo\applets\*.oza"; DestDir: "{app}\doc\demo\applets"; 
Components: docs\chm\applets
-; doc_duchierozmake
-;
-; doc_mozartstdlib
-;
-; doc_mt10
-Source: "doc\system\MT10.oz"; DestDir: "{app}\doc\system"; Flags: 
skipifsourcedoesntexist; Components: docs\chm
-; doc_system
-Source: "doc\system\MT10.ozf"; DestDir: "{app}\doc\system"; Flags: 
skipifsourcedoesntexist; Components: docs\chm
-; examples
-Source: "examples\*.*"; DestDir: "{app}\examples"; Flags: recursesubdirs; 
Components: docs\examples
-; include
-Source: "install\*.*"; DestDir: "{app}\include"; Flags: 
skipifsourcedoesntexist recursesubdirs; Components: base
-; platform_win32i486
-Source: "platform\win32-i486\*.*"; DestDir: "{app}\platform\win32-i486"; 
Flags: recursesubdirs; Components: base
-; share
-Source: "share\*.*"; DestDir: "{app}\share"; Components: base
-; share_doc
-Source: "share\doc\*.*"; DestDir: "{app}\share\doc"; Components: base
-; share_elisp
-Source: "share\elisp\*.*"; DestDir: "{app}\share\elisp"; Components: 
base\progint
-
-[Icons]
-Name: "{group}\Oz Programming Interface"; Filename: "{app}\bin\oz.exe"; 
Comment: "An integrated development environment for Oz"; Components: 
base\progint
-Name: "{group}\Documentation"; Filename: "{app}\doc\Mozart.chm"; 
Flags:runmaximized; Comment: "The Mozart online documentation."; Components: 
docs\chm
-
+[Setup]
+AppName=Mozart
+; icon: \bin\oz.exe
+AppCopyright=Open-Source system, see www.mozart-oz.org
+AppVerName=Mozart 1.3.1
+AppPublisher=SICS, DFKI, and other parties
+DefaultDirName={pf}\Mozart
+DefaultGroupName=Mozart
+AllowNoIcons=yes
+LicenseFile=LICENSE.rtf
+;InfoBeforeFile=README
+OutputBaseFilename=Mozart-1.3.1
+Compression=lzma
+SolidCompression=yes
+OutputDir=.
+ChangesAssociations=yes
+ChangesEnvironment=yes
+WizardImageFile=MozartSide.bmp
+WizardSmallImageFile=MozartSmall.bmp
+WizardImageBackcolor=$fffff0
+WizardImageStretch=no
+
+[Languages]
+Name: "english"; MessagesFile: "compiler:Default.isl"
+Name: "brazilianportuguese"; MessagesFile: 
"compiler:Languages\BrazilianPortuguese.isl"
+Name: "catalan"; MessagesFile: "compiler:Languages\Catalan.isl"
+Name: "czech"; MessagesFile: "compiler:Languages\Czech.isl"
+Name: "danish"; MessagesFile: "compiler:Languages\Danish.isl"
+Name: "dutch"; MessagesFile: "compiler:Languages\Dutch.isl"
+Name: "finnish"; MessagesFile: "compiler:Languages\Finnish.isl"
+Name: "french"; MessagesFile: "compiler:Languages\French.isl"
+Name: "german"; MessagesFile: "compiler:Languages\German.isl"
+Name: "hungarian"; MessagesFile: "compiler:Languages\Hungarian.isl"
+Name: "italian"; MessagesFile: "compiler:Languages\Italian.isl"
+Name: "norwegian"; MessagesFile: "compiler:Languages\Norwegian.isl"
+Name: "polish"; MessagesFile: "compiler:Languages\Polish.isl"
+Name: "portuguese"; MessagesFile: "compiler:Languages\Portuguese.isl"
+Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"
+Name: "slovak"; MessagesFile: "compiler:Languages\Slovak.isl"
+Name: "slovenian"; MessagesFile: "compiler:Languages\Slovenian.isl"
+
+[Icons]
+Name: "{group}\{cm:UninstallProgram,Mozart}"; Filename: "{uninstallexe}"
+
+[Components]
+Name: "base"; Description: "Base System"; Types: full compact custom; Flags: 
fixed checkablealone
+Name: "base\progint"; Description: "Programming Interface"; Types: full 
custom; Flags: checkablealone
+Name: "docs"; Description: "Documentation"; Types: full custom
+Name: "docs\chm"; Description: "Documentation"; Types: full custom; Flags: 
checkablealone
+Name: "docs\chm\applets"; Description: "Demo Applets"; Types: full custom; 
Flags: checkablealone
+Name: "docs\examples"; Description: "Examples"; Types: full custom; Flags: 
checkablealone
+Name: "contrib"; Description: "Contributions"; Types: full custom; Flags: 
checkablealone
+Name: "contrib\os"; Description: "OS"; Types: full custom; Flags: 
checkablealone
+Name: "contrib\gdbm"; Description: "GDBM"; Types: full custom; Flags: 
checkablealone
+Name: "contrib\regex"; Description: "Regular Expressions"; Types: full custom; 
Flags: checkablealone
+Name: "contrib\ap"; Description: "Application Programming"; Types: full 
custom; Flags: checkablealone
+Name: "contrib\compat"; Description: "Backwards Compatibility"; Types: full 
custom; Flags: checkablealone
+Name: "contrib\doc_c"; Description: "Documentation Processing"; Types: full 
custom; Flags: checkablealone
+Name: "contrib\tk"; Description: "Additional Widgets"; Types: full custom; 
Flags: checkablealone
+Name: "contrib\micq"; Description: "Mozart Instant Messenger"; Types: full 
custom; Flags: checkablealone
+Name: "contrib\directory"; Description: "Directory Service"; Types: full 
custom; Flags: checkablealone
+
+[Files]
+; base
+Source: "*.*"; Excludes: "*.iss,*.exe,*~"; DestDir: "{app}"; Components: base
+; bin
+; bin_oz
+; bin_ozengine
+; bin_ozenginew
+Source: "bin\*.*"; DestDir: "{app}\bin"; Components: base
+; cache_xoz_system
+Source: "cache\x-oz\system\*.*"; DestDir: "{app}\cache\x-oz\system"; Flags: 
recursesubdirs; Components: base
+; cache_xozlib
+Source: "cache\x-ozlib\*.*"; DestDir: "{app}\cache\x-ozlib"; Flags: 
recursesubdirs skipifsourcedoesntexist; Components: base
+; contrib_*
+Source: "cache\x-oz\contrib\ap\*.*"; DestDir: "{app}\cache\x-oz\contrib\ap"; 
Flags: skipifsourcedoesntexist recursesubdirs; Components: contrib\ap
+Source: "cache\x-oz\contrib\compat\*.*"; DestDir: 
"{app}\cache\x-oz\contrib\compat"; Flags: skipifsourcedoesntexist 
recursesubdirs; Components: contrib\compat
+Source: "cache\x-oz\contrib\directory\*.*"; DestDir: 
"{app}\cache\x-oz\contrib\directory"; Flags: skipifsourcedoesntexist 
recursesubdirs; Components: contrib\directory
+Source: "cache\x-oz\contrib\doc\*.*"; DestDir: "{app}\cache\x-oz\contrib\doc"; 
Flags: skipifsourcedoesntexist recursesubdirs; Components: contrib\doc_c
+Source: "cache\x-oz\contrib\gdbm.*"; DestDir: "{app}\cache\x-oz\contrib"; 
Flags: skipifsourcedoesntexist recursesubdirs; Components: contrib\gdbm
+Source: "cache\x-oz\contrib\micq\*.*"; DestDir: 
"{app}\cache\x-oz\contrib\micq"; Flags: skipifsourcedoesntexist recursesubdirs; 
Components: contrib\micq
+Source: "cache\x-oz\contrib\os\*.*"; DestDir: "{app}\cache\x-oz\contrib\os"; 
Flags: skipifsourcedoesntexist recursesubdirs; Components: contrib\os
+Source: "cache\x-oz\contrib\regex.*"; DestDir: "{app}\cache\x-oz\contrib"; 
Flags: skipifsourcedoesntexist recursesubdirs; Components: contrib\regex
+Source: "cache\x-oz\contrib\tk\*.*"; DestDir: "{app}\cache\x-oz\contrib\tk"; 
Flags: skipifsourcedoesntexist recursesubdirs; Components: contrib\tk
+; convertTextPickle
+Source: "bin\convertTextPickle"; DestDir: "{app}\bin"; DestName: 
"convertTextPickle.exe"; Components: base; Flags: skipifsourcedoesntexist
+; doc
+Source: "doc\Mozart.chm"; DestDir: "{app}\doc"; Components: docs\chm; Flags: 
skipifsourcedoesntexist
+; doc_addons
+Source: "doc\add-ons\*.*"; DestDir: "{app}\doc\add-ons"; Components: docs\chm; 
Flags: skipifsourcedoesntexist recursesubdirs
+; doc_demo_applets
+Source: "doc\demo\applets\*.*"; DestDir: "{app}\doc\demo\applets"; Components: 
docs\chm\applets; Flags: skipifsourcedoesntexist recursesubdirs
+; doc_duchierozmake
+Source: "doc\mozart-ozmake\*.*"; DestDir: "{app}\doc\mozart-ozmake"; 
Components: docs\chm; Flags: skipifsourcedoesntexist recursesubdirs
+; doc_mozartstdlib
+;
+; doc_mt10
+Source: "doc\system\MT10.oz"; DestDir: "{app}\doc\system"; Flags: 
skipifsourcedoesntexist; Components: docs\chm
+; doc_system
+Source: "doc\system\MT10.ozf"; DestDir: "{app}\doc\system"; Flags: 
skipifsourcedoesntexist; Components: docs\chm
+; examples
+Source: "examples\*.*"; DestDir: "{app}\examples"; Flags: recursesubdirs; 
Components: docs\examples
+; include
+Source: "include\*.*"; DestDir: "{app}\include"; Flags: 
skipifsourcedoesntexist recursesubdirs; Components: base
+; platform_win32i486
+Source: "platform\win32-i486\*.*"; DestDir: "{app}\platform\win32-i486"; 
Flags: recursesubdirs; Components: base
+; share
+Source: "share\*.*"; DestDir: "{app}\share"; Components: base
+; share_doc
+Source: "share\doc\*.*"; DestDir: "{app}\share\doc"; Components: base
+; share_elisp
+Source: "share\elisp\*.*"; DestDir: "{app}\share\elisp"; Components: 
base\progint
+
+[Icons]
+Name: "{group}\Oz Programming Interface"; Filename: "{app}\bin\oz.exe"; 
Comment: "An integrated development environment for Oz"; Components: 
base\progint
+Name: "{group}\Documentation"; Filename: "{app}\doc\Mozart.chm"; 
Flags:runmaximized; Comment: "The Mozart online documentation."; Components: 
docs\chm
+
 [Registry]
 Root: HKCR; Subkey: ".oz"; ValueType: string; ValueName: ""; ValueData: 
"OzSource"; Flags: uninsdeletevalue; Components: base\progint
 Root: HKCR; Subkey: "OzSource"; ValueType: string; ValueName: ""; ValueData: 
"Oz Source"; Flags: uninsdeletekey; Components: base\progint
@@ -132,33 +128,33 @@
 Root: HKCR; Subkey: "OzApplication"; ValueType: string; ValueName: ""; 
ValueData: "Oz Application"; Flags: uninsdeletekey; Components: base\progint
 Root: HKCR; Subkey: "OzApplication\DefaultIcon"; ValueType: string; ValueName: 
""; ValueData: "{app}\bin\ozenginew.exe,0"; Components: base\progint
 Root: HKCR; Subkey: "OzApplication\shell\open\command"; ValueType: string; 
ValueName: ""; ValueData: """{app}\bin\ozenginew.exe"" ""%1"""; Components: 
base\progint
-
-[Code]
-#include "ModifyPath.iss"
-
-procedure CurStepChanged(CurStep: TSetupStep);
-begin
-  case CurStep of
-    ssPostInstall:
-      begin
-        if ExpandConstant('{userdocs}') = ExpandConstant('{commondocs}') then
-          ModifyPath('{app}\bin', pmAddToEnd, psAllUsers)
-        else
-          ModifyPath('{app}\bin', pmAddToEnd, psCurrentUser)
-      end
-  end
-end;
-
-procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
-begin
-  case CurUninstallStep of
-    usPostUninstall:
-      begin
-        if ExpandConstant('{userdocs}') = ExpandConstant('{commondocs}') then
-          ModifyPath('{app}\bin', pmRemove, psAllUsers)
-        else
-          ModifyPath('{app}\bin', pmRemove, psCurrentUser)
-      end
-  end
-end;
-
+
+[Code]
+#include "ModifyPath.iss"
+
+procedure CurStepChanged(CurStep: TSetupStep);
+begin
+  case CurStep of
+    ssPostInstall:
+      begin
+        if IsAdminLoggedOn then
+          ModifyPath('{app}\bin', pmAddToEnd, psAllUsers)
+        else
+          ModifyPath('{app}\bin', pmAddToEnd, psCurrentUser)
+      end
+  end
+end;
+
+procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
+begin
+  case CurUninstallStep of
+    usPostUninstall:
+      begin
+        if IsAdminLoggedOn then
+          ModifyPath('{app}\bin', pmRemove, psAllUsers)
+        else
+          ModifyPath('{app}\bin', pmRemove, psCurrentUser)
+      end
+  end
+end;
+
Index: misc/ModifyPath.iss
===================================================================
RCS file: /services/mozart/CVS/mozart/misc/Attic/ModifyPath.iss,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 ModifyPath.iss
--- misc/ModifyPath.iss 5 Apr 2006 16:42:33 -0000       1.1.2.1
+++ misc/ModifyPath.iss 2 Jun 2006 07:57:03 -0000
@@ -1,293 +1,293 @@
-// Version log:
-// 03/31/2003: Initial release (thv(at)lr.dk)
-
-const
-  // Modification method
-  pmAddToBeginning = $1;      // Add dir to beginning of Path
-  pmAddToEnd = $2;            // Add dir to end of Path
-  pmAddAllways = $4;          // Add also if specified dir is already included 
in existing path
-  pmAddOnlyIfDirExists = $8;  // Add only if specified dir actually exists
-  pmRemove = $10;             // Remove dir from path
-
-  pmRemoveSubdirsAlso = $20;  // Remove dir and all subdirs from path
-
-  // Scope
-  psCurrentUser = 1;          // Modify path for current user
-  psAllUsers = 2;             // Modify path for all users
-
-  // Error results
-  mpOK = 0;                   // No errors
-  mpMissingRights = -1;       // User has insufficient rights
-  mpAutoexecNoWriteacc = -2;  // Autoexec can not be written (may be readonly)
-  mpBothAddAndRemove = -3;    // User has specified that dir should both be 
removed from and added to path
-
-
-{ Helper procedure: Split a path environment variable into individual dirnames 
}
-procedure SplitPath(Path: string; var Dirs: TStringList);
-var
-  pos: integer;
-  s: string;
-begin
-  Dirs.Clear;
-  s := '';
-  pos := 1;
-  while (pos<=Length(Path)) do
-  begin
-    if (Path[pos]<>';') then
-      s := s + Path[pos];
-    if ((Path[pos]=';') or (pos=Length(Path))) then
-    begin
-      s := Trim(s);
-      s := RemoveQuotes(s);
-      s := Trim(s);
-      if (s <> '') then
-        Dirs.Add(s);
-      s := '';
-    end;
-    Pos := Pos + 1;
-  end;
-end; // procedure SplitPath
-
-
-{ Helper procedure: Concatenate individual dirnames into a path environment 
variable }
-procedure ConcatPath(Dirs: TStringList; Quotes: boolean; var Path: string);
-var
-  Index, MaxIndex: integer;
-  s: string;
-begin
-  MaxIndex := Dirs.Count-1;
-  Path := '';
-  for Index := 0 to MaxIndex do
-  begin
-    s := Dirs.Strings[Index];
-    if ((Quotes) and (pos(' ',s) > 0)) then
-      s := AddQuotes(s);
-    Path := Path + s;
-    if (Index < MaxIndex) then
-      Path := Path + ';'
-  end;
-end; // procedure ConcatPath
-
-
-{ Helper function: Modifies path environment string }
-procedure ModifyPathString(OldPath, DirName: string; Method: integer; Quotes: 
boolean; var ResultPath: string);
-var
-  Dirs: TStringList;
-  DirNotInPath: Boolean;
-  i: integer;
-begin
-  // Create Dirs variable
-  Dirs := TStringList.Create;
-
-  // Remove quotes form DirName
-  DirName := Trim(DirName);
-  DirName := RemoveQuotes(DirName);
-  DirName := Trim(DirName);
-
-  // Split old path in individual directory names
-  SplitPath(OldPath, Dirs);
-
-  // Check if dir is allready in path
-  DirNotInPath := True;
-  for i:=Dirs.Count-1 downto 0 do
-  begin
-    if (uppercase(Dirs.Strings[i]) = uppercase(DirName)) then
-      DirNotInPath := False;
-  end;
-
-  // Should dir be removed from existing Path?
-  if ((Method and (pmRemove or pmRemoveSubdirsAlso)) > 0) then
-  begin
-    for i:=Dirs.Count-1 downto 0 do
-    begin
-      if (((Method and pmRemoveSubdirsAlso) > 0) and 
(pos(uppercase(DirName)+'', uppercase(Dirs.Strings[i])) = 1)) or
-         (((Method and (pmRemove) or (pmRemoveSubdirsAlso)) > 0) and 
(uppercase(DirName) = uppercase(Dirs.Strings[i])))
-      then
-        Dirs.Delete(i);
-    end;
-  end;
-
-  // Should dir be added to existing Path?
-  if ((Method and (pmAddToBeginning or pmAddToEnd)) > 0) then
-  begin
-    // Add dir to path
-    if (((Method and pmAddAllways) > 0) or DirNotInPath) then
-    begin
-      // Dir is not in path allready or should be added anyway
-      if (((Method and pmAddOnlyIfDirExists) = 0) or (DirExists(DirName))) then
-      begin
-        // Dir actually exsists or should be added anyway
-        if ((Method and pmAddToBeginning) > 0) then
-          Dirs.Insert(0, DirName)
-        else
-          Dirs.Append(DirName);
-      end;
-    end;
-  end;
-
-  // Concatenate directory names into one single path variable
-  ConcatPath(Dirs, Quotes, ResultPath);
-  // Finally free Dirs object
-  Dirs.Free;
-end; // ModifyPathString
-
-
-{ Helper function: Modify path on Windows 9x }
-function ModifyPath9x(DirName: string; Method: integer): integer;
-var
-  AutoexecLines: TStringList;
-  ActualLine: String;
-  PathLineNos: TStringList;
-  FirstPathLineNo: Integer;
-  OldPath, ResultPath: String;
-  LineNo, CharNo, Index: integer;
-
-  TempString: String;
-begin
-  // Expect everything to be OK
-  result := mpOK;
-
-  // Create stringslists
-  AutoexecLines := TStringList.Create;
-  PathLineNos := TStringList.Create;
-
-  // Read existing path
-  OldPath := '';
-  LoadStringFromFile('c:\Autoexec.bat', TempString);
-  AutoexecLines.Text := TempString;
-  PathLineNos.Clear;
-  // Read Autoexec line by line
-  for LineNo := 0 to AutoexecLines.Count - 1 do begin
-    ActualLine := AutoexecLines.Strings[LineNo];
-    // Check if line starts with "PATH=" after first stripping spaces and 
other "fill-chars"
-    if Pos('=', ActualLine) > 0 then
-    begin
-      for CharNo := Pos('=', ActualLine)-1 downto 1 do
-        if (ActualLine[CharNo]=' ') or (ActualLine[CharNo]=#9) then
-          Delete(ActualLine, CharNo, 1);
-      if Pos('@', ActualLine) = 1 then
-        Delete(ActualLine, 1, 1);
-      if (Pos('PATH=', uppercase(ActualLine))=1) or (Pos('SETPATH=', 
uppercase(ActualLine))=1) then
-      begin
-        // Remove 'PATH=' and add path to "OldPath" variable
-        Delete(ActualLine, 1, pos('=', ActualLine));
-        // Check if an earlier PATH variable is referenced, but there has been 
no previous PATH defined in Autoexec
-        if (pos('%PATH%',uppercase(ActualLine))>0) and (PathLineNos.Count=0) 
then
-          OldPath := ExpandConstant('{win}') + ';' + 
ExpandConstant('{win}')+'\COMMAND';
-        if (pos('%PATH%',uppercase(ActualLine))>0) then
-        begin
-          ActualLine := Copy(ActualLine, 1, 
pos('%PATH%',uppercase(ActualLine))-1) +
-                        OldPath +
-                        Copy(ActualLine, 
pos('%PATH%',uppercase(ActualLine))+6, Length(ActualLine));
-        end;
-        OldPath := ActualLine;
-
-        // Update list of line numbers holding path variables
-        PathLineNos.Add(IntToStr(LineNo));
-      end;
-    end;
-  end;
-
-  // Save first line number in Autoexec.bat which modifies path environment 
variable
-  if PathLineNos.Count > 0 then
-    FirstPathLineNo := StrToInt(PathLineNos.Strings[0])
-  else
-    FirstPathLineNo := 0;
-
-  // Modify path
-  ModifyPathString(OldPath, DirName, Method, True, ResultPath);
-
-  // Write Modified path back to Autoexec.bat
-  // First delete all existing path references from Autoexec.bat
-  Index := PathLineNos.Count-1;
-  while (Index>=0) do
-  begin
-    AutoexecLines.Delete(StrToInt(PathLineNos.Strings[Index]));
-    Index := Index-1;
-  end;
-  // Then insert new path variable into Autoexec.bat
-  AutoexecLines.Insert(FirstPathLineNo, '@PATH='+ResultPath);
-  // Delete old Autoexec.bat from disk
-  if not DeleteFile('c:\Autoexec.bat') then
-    result := mpAutoexecNoWriteAcc;
-  Sleep(500);
-  // And finally write Autoexec.bat back to disk
-  if not (result=mpAutoexecNoWriteAcc) then
-    SaveStringToFile('c:\Autoexec.bat', AutoexecLines.Text, false);
-
-  // Free stringlists
-  PathLineNos.Free;
-  AutoexecLines.Free;
-end; // ModifyPath9x
-
-
-{ Helper function: Modify path on Windows NT, 2000 and XP }
-function ModifyPathNT(DirName: string; Method, Scope: integer): integer;
-var
-  RegRootKey: integer;
-  RegSubKeyName: string;
-  RegValueName: string;
-  OldPath, ResultPath: string;
-  OK: boolean;
-begin
-  // Expect everything to be OK
-  result := mpOK;
-
-  // Initialize registry key and value names to reflect if changes should be 
global or local to current user only
-  case Scope of
-    psCurrentUser:
-      begin
-        RegRootKey := HKEY_CURRENT_USER;
-        RegSubKeyName := 'Environment';
-        RegValueName := 'Path';
-      end;
-    psAllUsers:
-      begin
-        RegRootKey := HKEY_LOCAL_MACHINE;
-        RegSubKeyName := 'SYSTEM\CurrentControlSet\Control\Session 
Manager\Environment';
-        RegValueName := 'Path';
-      end;
-  end;
-
-  // Read current path value from registry
-  OK := RegQueryStringValue(RegRootKey, RegSubKeyName, RegValueName, OldPath);
-  if not OK then
-  begin
-    result := mpMissingRights;
-    Exit;
-  end;
-
-  // Modify path
-  ModifyPathString(OldPath, DirName, Method, False, ResultPath);
-
-  // Write new path value to registry
-  if not RegWriteStringValue(RegRootKey, RegSubKeyName, RegValueName, 
ResultPath) then
-  begin
-    result := mpMissingRights;
-    Exit;
-
-  end;
-end; // ModifyPathNT
-
-
-{ Main function: Modify path }
-function ModifyPath(Path: string; Method, Scope: integer): integer;
-begin
-  // Check if both add and remove has been specified (= error!)
-  if (Method and (pmAddToBeginning or pmAddToEnd) and (pmRemove or 
pmRemoveSubdirsAlso)) > 0 then
-  begin
-    result := mpBothAddAndRemove;
-    Exit;
-  end;
-
-  // Perform directory constant expansion
-  Path := ExpandConstantEx(Path, ' ', ' ');
-
-  // Test if Win9x
-  if InstallOnThisVersion('4,0','0,0') = irInstall then
-    ModifyPath9x(Path, Method);
-
-  // Test if WinNT, 2000 or XP
-  if InstallOnThisVersion('0,4','0,0') = irInstall then
-    ModifyPathNT(Path, Method, Scope);
-end; // ModifyPath
+// Version log:
+// 03/31/2003: Initial release (thv(at)lr.dk)
+
+const
+  // Modification method
+  pmAddToBeginning = $1;      // Add dir to beginning of Path
+  pmAddToEnd = $2;            // Add dir to end of Path
+  pmAddAllways = $4;          // Add also if specified dir is already included 
in existing path
+  pmAddOnlyIfDirExists = $8;  // Add only if specified dir actually exists
+  pmRemove = $10;             // Remove dir from path
+
+  pmRemoveSubdirsAlso = $20;  // Remove dir and all subdirs from path
+
+  // Scope
+  psCurrentUser = 1;          // Modify path for current user
+  psAllUsers = 2;             // Modify path for all users
+
+  // Error results
+  mpOK = 0;                   // No errors
+  mpMissingRights = -1;       // User has insufficient rights
+  mpAutoexecNoWriteacc = -2;  // Autoexec can not be written (may be readonly)
+  mpBothAddAndRemove = -3;    // User has specified that dir should both be 
removed from and added to path
+
+
+{ Helper procedure: Split a path environment variable into individual dirnames 
}
+procedure SplitPath(Path: string; var Dirs: TStringList);
+var
+  pos: integer;
+  s: string;
+begin
+  Dirs.Clear;
+  s := '';
+  pos := 1;
+  while (pos<=Length(Path)) do
+  begin
+    if (Path[pos]<>';') then
+      s := s + Path[pos];
+    if ((Path[pos]=';') or (pos=Length(Path))) then
+    begin
+      s := Trim(s);
+      s := RemoveQuotes(s);
+      s := Trim(s);
+      if (s <> '') then
+        Dirs.Add(s);
+      s := '';
+    end;
+    Pos := Pos + 1;
+  end;
+end; // procedure SplitPath
+
+
+{ Helper procedure: Concatenate individual dirnames into a path environment 
variable }
+procedure ConcatPath(Dirs: TStringList; Quotes: boolean; var Path: string);
+var
+  Index, MaxIndex: integer;
+  s: string;
+begin
+  MaxIndex := Dirs.Count-1;
+  Path := '';
+  for Index := 0 to MaxIndex do
+  begin
+    s := Dirs.Strings[Index];
+    if ((Quotes) and (pos(' ',s) > 0)) then
+      s := AddQuotes(s);
+    Path := Path + s;
+    if (Index < MaxIndex) then
+      Path := Path + ';'
+  end;
+end; // procedure ConcatPath
+
+
+{ Helper function: Modifies path environment string }
+procedure ModifyPathString(OldPath, DirName: string; Method: integer; Quotes: 
boolean; var ResultPath: string);
+var
+  Dirs: TStringList;
+  DirNotInPath: Boolean;
+  i: integer;
+begin
+  // Create Dirs variable
+  Dirs := TStringList.Create;
+
+  // Remove quotes form DirName
+  DirName := Trim(DirName);
+  DirName := RemoveQuotes(DirName);
+  DirName := Trim(DirName);
+
+  // Split old path in individual directory names
+  SplitPath(OldPath, Dirs);
+
+  // Check if dir is allready in path
+  DirNotInPath := True;
+  for i:=Dirs.Count-1 downto 0 do
+  begin
+    if (uppercase(Dirs.Strings[i]) = uppercase(DirName)) then
+      DirNotInPath := False;
+  end;
+
+  // Should dir be removed from existing Path?
+  if ((Method and (pmRemove or pmRemoveSubdirsAlso)) > 0) then
+  begin
+    for i:=Dirs.Count-1 downto 0 do
+    begin
+      if (((Method and pmRemoveSubdirsAlso) > 0) and 
(pos(uppercase(DirName)+'', uppercase(Dirs.Strings[i])) = 1)) or
+         (((Method and (pmRemove) or (pmRemoveSubdirsAlso)) > 0) and 
(uppercase(DirName) = uppercase(Dirs.Strings[i])))
+      then
+        Dirs.Delete(i);
+    end;
+  end;
+
+  // Should dir be added to existing Path?
+  if ((Method and (pmAddToBeginning or pmAddToEnd)) > 0) then
+  begin
+    // Add dir to path
+    if (((Method and pmAddAllways) > 0) or DirNotInPath) then
+    begin
+      // Dir is not in path allready or should be added anyway
+      if (((Method and pmAddOnlyIfDirExists) = 0) or (DirExists(DirName))) then
+      begin
+        // Dir actually exsists or should be added anyway
+        if ((Method and pmAddToBeginning) > 0) then
+          Dirs.Insert(0, DirName)
+        else
+          Dirs.Append(DirName);
+      end;
+    end;
+  end;
+
+  // Concatenate directory names into one single path variable
+  ConcatPath(Dirs, Quotes, ResultPath);
+  // Finally free Dirs object
+  Dirs.Free;
+end; // ModifyPathString
+
+
+{ Helper function: Modify path on Windows 9x }
+function ModifyPath9x(DirName: string; Method: integer): integer;
+var
+  AutoexecLines: TStringList;
+  ActualLine: String;
+  PathLineNos: TStringList;
+  FirstPathLineNo: Integer;
+  OldPath, ResultPath: String;
+  LineNo, CharNo, Index: integer;
+
+  TempString: String;
+begin
+  // Expect everything to be OK
+  result := mpOK;
+
+  // Create stringslists
+  AutoexecLines := TStringList.Create;
+  PathLineNos := TStringList.Create;
+
+  // Read existing path
+  OldPath := '';
+  LoadStringFromFile('c:\Autoexec.bat', TempString);
+  AutoexecLines.Text := TempString;
+  PathLineNos.Clear;
+  // Read Autoexec line by line
+  for LineNo := 0 to AutoexecLines.Count - 1 do begin
+    ActualLine := AutoexecLines.Strings[LineNo];
+    // Check if line starts with "PATH=" after first stripping spaces and 
other "fill-chars"
+    if Pos('=', ActualLine) > 0 then
+    begin
+      for CharNo := Pos('=', ActualLine)-1 downto 1 do
+        if (ActualLine[CharNo]=' ') or (ActualLine[CharNo]=#9) then
+          Delete(ActualLine, CharNo, 1);
+      if Pos('@', ActualLine) = 1 then
+        Delete(ActualLine, 1, 1);
+      if (Pos('PATH=', uppercase(ActualLine))=1) or (Pos('SETPATH=', 
uppercase(ActualLine))=1) then
+      begin
+        // Remove 'PATH=' and add path to "OldPath" variable
+        Delete(ActualLine, 1, pos('=', ActualLine));
+        // Check if an earlier PATH variable is referenced, but there has been 
no previous PATH defined in Autoexec
+        if (pos('%PATH%',uppercase(ActualLine))>0) and (PathLineNos.Count=0) 
then
+          OldPath := ExpandConstant('{win}') + ';' + 
ExpandConstant('{win}')+'\COMMAND';
+        if (pos('%PATH%',uppercase(ActualLine))>0) then
+        begin
+          ActualLine := Copy(ActualLine, 1, 
pos('%PATH%',uppercase(ActualLine))-1) +
+                        OldPath +
+                        Copy(ActualLine, 
pos('%PATH%',uppercase(ActualLine))+6, Length(ActualLine));
+        end;
+        OldPath := ActualLine;
+
+        // Update list of line numbers holding path variables
+        PathLineNos.Add(IntToStr(LineNo));
+      end;
+    end;
+  end;
+
+  // Save first line number in Autoexec.bat which modifies path environment 
variable
+  if PathLineNos.Count > 0 then
+    FirstPathLineNo := StrToInt(PathLineNos.Strings[0])
+  else
+    FirstPathLineNo := 0;
+
+  // Modify path
+  ModifyPathString(OldPath, DirName, Method, True, ResultPath);
+
+  // Write Modified path back to Autoexec.bat
+  // First delete all existing path references from Autoexec.bat
+  Index := PathLineNos.Count-1;
+  while (Index>=0) do
+  begin
+    AutoexecLines.Delete(StrToInt(PathLineNos.Strings[Index]));
+    Index := Index-1;
+  end;
+  // Then insert new path variable into Autoexec.bat
+  AutoexecLines.Insert(FirstPathLineNo, '@PATH='+ResultPath);
+  // Delete old Autoexec.bat from disk
+  if not DeleteFile('c:\Autoexec.bat') then
+    result := mpAutoexecNoWriteAcc;
+  Sleep(500);
+  // And finally write Autoexec.bat back to disk
+  if not (result=mpAutoexecNoWriteAcc) then
+    SaveStringToFile('c:\Autoexec.bat', AutoexecLines.Text, false);
+
+  // Free stringlists
+  PathLineNos.Free;
+  AutoexecLines.Free;
+end; // ModifyPath9x
+
+
+{ Helper function: Modify path on Windows NT, 2000 and XP }
+function ModifyPathNT(DirName: string; Method, Scope: integer): integer;
+var
+  RegRootKey: integer;
+  RegSubKeyName: string;
+  RegValueName: string;
+  OldPath, ResultPath: string;
+  OK: boolean;
+begin
+  // Expect everything to be OK
+  result := mpOK;
+
+  // Initialize registry key and value names to reflect if changes should be 
global or local to current user only
+  case Scope of
+    psCurrentUser:
+      begin
+        RegRootKey := HKEY_CURRENT_USER;
+        RegSubKeyName := 'Environment';
+        RegValueName := 'Path';
+      end;
+    psAllUsers:
+      begin
+        RegRootKey := HKEY_LOCAL_MACHINE;
+        RegSubKeyName := 'SYSTEM\CurrentControlSet\Control\Session 
Manager\Environment';
+        RegValueName := 'Path';
+      end;
+  end;
+
+  // Read current path value from registry
+  OK := RegQueryStringValue(RegRootKey, RegSubKeyName, RegValueName, OldPath);
+  if not OK and (Scope=psAllUsers) then
+  begin
+    result := mpMissingRights;
+    Exit;
+  end;
+
+  // Modify path
+  ModifyPathString(OldPath, DirName, Method, False, ResultPath);
+
+  // Write new path value to registry
+  if not RegWriteStringValue(RegRootKey, RegSubKeyName, RegValueName, 
ResultPath) then
+  begin
+    result := mpMissingRights;
+    Exit;
+
+  end;
+end; // ModifyPathNT
+
+
+{ Main function: Modify path }
+function ModifyPath(Path: string; Method, Scope: integer): integer;
+begin
+  // Check if both add and remove has been specified (= error!)
+  if (Method and (pmAddToBeginning or pmAddToEnd) and (pmRemove or 
pmRemoveSubdirsAlso)) > 0 then
+  begin
+    result := mpBothAddAndRemove;
+    Exit;
+  end;
+
+  // Perform directory constant expansion
+  Path := ExpandConstantEx(Path, ' ', ' ');
+
+  // Test if Win9x
+  if InstallOnThisVersion('4,0','0,0') = irInstall then
+    ModifyPath9x(Path, Method);
+
+  // Test if WinNT, 2000 or XP
+  if InstallOnThisVersion('0,4','0,0') = irInstall then
+    ModifyPathNT(Path, Method, Scope);
+end; // ModifyPath
_________________________________________________________________________________
mozart-hackers mailing list                           
[email protected]      
http://www.mozart-oz.org/mailman/listinfo/mozart-hackers

Reply via email to