|
From: <sag...@us...> - 2010-01-25 19:22:29
|
Revision: 477
http://modplug.svn.sourceforge.net/modplug/?rev=477&view=rev
Author: saga-games
Date: 2010-01-25 19:22:19 +0000 (Mon, 25 Jan 2010)
Log Message:
-----------
[Mod] Installer: Using a GUID for AppId
[New] Installer: Scan for previously installed VST Plugins
Modified Paths:
--------------
trunk/OpenMPT/installer/install.iss
Added Paths:
-----------
trunk/OpenMPT/installer/vst_scan.iss
Modified: trunk/OpenMPT/installer/install.iss
===================================================================
--- trunk/OpenMPT/installer/install.iss 2010-01-25 16:38:56 UTC (rev 476)
+++ trunk/OpenMPT/installer/install.iss 2010-01-25 19:22:19 UTC (rev 477)
@@ -4,7 +4,7 @@
; http://sagagames.de/
[Setup]
-AppId=OpenMPT
+AppId={{67903736-E9BB-4664-B148-F62BCAB4FA42}
AppVerName=OpenMPT 1.18
AppVersion=1.18.00.00
AppName=OpenMPT
@@ -29,11 +29,12 @@
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}";
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "portable"; Description: "Use program directory to store configuration in"; GroupDescription: "Options:"; Flags: unchecked
+Name: "vst_scan"; Description: "Scan for previously installed VST plugins"; GroupDescription: "Options:"; Flags: unchecked
; file associations - put this below all other [tasks]!
#include "filetypes.iss"
[Languages]
-Name: "en"; MessagesFile: "compiler:Default.isl"
+Name: "english"; MessagesFile: "compiler:Default.isl"
[Files]
; you may want to change the base paths here
@@ -139,3 +140,4 @@
end;
end;
+#include "vst_scan.iss"
Added: trunk/OpenMPT/installer/vst_scan.iss
===================================================================
--- trunk/OpenMPT/installer/vst_scan.iss (rev 0)
+++ trunk/OpenMPT/installer/vst_scan.iss 2010-01-25 19:22:19 UTC (rev 477)
@@ -0,0 +1,124 @@
+[CustomMessages]
+english.ProgressTitle=Searching
+english.ProgressCaption=Searching for VST plugins
+english.ProgressText=Searching for plugin files...
+
+; http://www.vincenzo.net/isxkb/index.php?title=Search_for_a_file
+
+[Code]
+var
+ ProgressPage: TOutputProgressWizardPage;
+ ProgressValue: Integer;
+ ArrayLen: LongInt;
+ bExitSetup: Boolean;
+ INIFile: String;
+ VSTPluginNumber: Integer;
+
+procedure ProcessDirectory (RootDir: String; Progress: Boolean);
+var
+ NewRoot: String;
+ FilePath: String;
+ FindRec: TFindRec;
+begin
+ if bExitSetup then
+ Exit;
+ NewRoot := AddBackSlash (RootDir);
+ if FindFirst (NewRoot + '*', FindRec) then
+ begin
+ try
+ repeat
+ if (FindRec.Name <> '.') AND (FindRec.Name <> '..') then
+ begin
+ FilePath := NewRoot + FindRec.Name;
+ if FindRec.Attributes AND FILE_ATTRIBUTE_DIRECTORY > 0 then
+ ProcessDirectory (FilePath, Progress)
+ else
+ begin
+ // Start action -->
+ // .
+ // Add your custom code here.
+ // FilePath contains the file name
+ // including its full path name.
+ // Try not to call a function for every file
+ // as this could take a very long time.
+ // .
+ // <-- End action.
+ SetIniString('VST Plugins', 'Plugin' + IntToStr(VSTPluginNumber), FilePath, INIFile);
+ VSTPluginNumber := VSTPluginNumber +1;
+
+ ArrayLen := ArrayLen + 1;
+ if (Progress) then
+ begin
+ if (ArrayLen mod 1000) = (ArrayLen / 1000) then
+ begin
+ ProgressValue := ProgressValue + 1;
+ if ProgressValue = 100 then
+ ProgressValue := 0;
+ ProgressPage.SetProgress (ProgressValue, 100);
+ end;
+ end;
+ end;
+ end;
+ if (bExitSetup) then
+ Exit;
+ until NOT FindNext (FindRec);
+ finally
+ FindClose(FindRec);
+ end;
+ end;
+end;
+
+function MessageBox (hWnd: Integer; lpText, lpCaption: String; uType: Cardinal): Integer;
+ external 'Mes...@us... stdcall';
+
+procedure CancelButtonClick (CurPageID: Integer; var Cancel, Confirm: Boolean);
+begin
+ Confirm := FALSE;
+ if (MessageBox (0, SetupMessage (msgExitSetupMessage),
+ SetupMessage (msgExitSetupTitle), 4 + 32) = 6) then
+ begin
+ bExitSetup := TRUE;
+ end;
+end;
+
+procedure CurStepChanged (CurStep: TSetupStep);
+var
+ Dir: String;
+begin
+ if ((CurStep = ssInstall) And (IsTaskSelected('vst_scan'))) then
+ begin
+
+ // Get the right INI path.
+ if(IsTaskSelected('portable')) then
+ begin
+ INIFile := ExpandConstant('{app}\mptrack.ini');
+ end else
+ begin
+ INIFile := ExpandConstant('{userappdata}\OpenMPT\mptrack.ini');
+ end;
+ VSTPluginNumber := GetIniInt('VST Plugins', 'NumPlugin', 0, 0, 0, INIFile);
+
+ // The folder to scan.
+ Dir := ExpandConstant('{pf}\Steinberg\VstPlugins');
+ RegQueryStringValue(HKEY_LOCAL_MACHINE, 'Software\VST', 'VSTPluginsPath', Dir); // won't touch Dir if registry path does not exist
+ // The progress page.
+ ProgressPage := CreateOutputProgressPage (CustomMessage ('ProgressTitle'),
+ CustomMessage ('ProgressCaption'));
+ ProgressPage.SetText (CustomMessage ('ProgressText'), Dir);
+ ProgressPage.SetProgress(0, 0);
+ ProgressPage.Show;
+ // Make the Cancel button visible during the operation.
+ ;WizardForm.CancelButton.Visible := TRUE;
+ // Scan the folder.
+ ProcessDirectory (Dir, TRUE);
+ // Hide the progress page.
+ try
+ finally
+ ProgressPage.Hide;
+ end;
+
+ // Update INI key
+ SetIniInt('VST Plugins', 'NumPlugin', VSTPluginNumber, INIFile);
+ end;
+end;
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|