Okay, so SetupS has (for quite some time actually) the following function -- which only gets called whenever the variable %CDROM% or %CDDrive% is used:
Code: Select all
Func GetOpticalDrive()
If $Debug Then _ConsoleWriteDebug('@@ Debug(Trace) SetupS.Core.au3|GetOpticalDrive()' & @CRLF)
Local $i, $Found, $Drive, $File
ErrorProtection('off')
; Check System Varibles
If $HomeDrv = '' Then $HomeDrv = 'C:'
If $SystemDrive = '' Then $SystemDrive = 'C:'
; Get CD Drive (if any)
If FileExists(@WindowsDir & '\SetupSCDDrive.ini') Then FileDelete(@WindowsDir & '\SetupSCDDrive.ini')
If IsArray($CDDrivesList) Then
If $CDDrivesList[0] > 0 Then
For $Drive = 1 To $CDDrivesList[0]
If FileExists($CDDrivesList[$Drive] & '\ssWPICD.ini') Then
$CDDrive = $CDDrivesList[$Drive]
ExitLoop
EndIf
Next
EndIf
EndIf
If $CDDrive = '' Or Not FileExists($CDDrive) Then ;pick the first available one
If IsArray($CDDrivesList) Then
If $CDDrivesList[0] > 0 Then
$CDDrive = $CDDrivesList[1]
Else
$CDDrive = $SystemDrive
EndIf
Else
$CDDrive = $SystemDrive
EndIf
EndIf
$CDDrive = NoBackslash($CDDrive)
ErrorProtection('on')
EndFunc
Basically very similar to the line of code used inside scripts like FirstLogon.cmd that searched for a file called "ssWPICD.ini". Notably:
Code: Select all
For $Drive = 1 To $CDDrivesList[0]
If FileExists($CDDrivesList[$Drive] & '\ssWPICD.ini') Then
$CDDrive = $CDDrivesList[$Drive]
ExitLoop
EndIf
Next
I've changed it to instead check to see if SetupS is being called from one of the list of Optical-drives:
Code: Select all
For $Drive = 1 To $CDDrivesList[0]
If $CDDrivesList[$Drive] = StringLeft(@ScriptDir, 2) Then ; Residing drive is on a CD-ROM
$CDDrive = $CDDrivesList[$Drive]
ExitLoop
EndIf
Next
This is better. But it seems to me this function is very outdated even so. Yes, it detects mounted virtual drives as "CD-ROM's" but even the variable name is outdated because such drives have evolved past CD's into DVD's and now Blu-ray. Perhaps I'll add a new variable called "%OpticalDrive%".
In any case, I can see this variable as limiting. There's a variety of ways to boot into the OS now (USB, "Pixie", etc.). And just look at all the various ways to boot from USB: Flash-drive, HDD/SSD, even some type of Optical.
I know there's a long list of SetupS variables; and already I'm thinking of adding to it such variables as %OpticalDrive% and %ThisPath%/%ThisDrive%/%ThisFolder%. Here's what we have presently:
Code: Select all
%SourcePath% Full path (drive + folder) to the .ini|.app|.ppg file.
%SourceDrive% drive only of the .ini|.app|.ppg file.
%SourceFolder% folder only path to the .ini|.app|.ppg file.
%ppApps% Full path (drive + folder) to the system's 'x:\ppApps\' folder.
%ppAppsDrive% drive only of the system's 'x:\ppApps\' folder.
%ppGames% Full path (drive + folder) to the system's 'x:\ppGames\' folder.
%ppGamesDrive% drive only of the system's 'x:\ppGames\' folder.
%Tools% Full path (drive + folder) to SetupS's '\tools\' folder.
%ToolsDrive% drive only of SetupS's '\tools\' folder.
%ToolsFolder% folder only path to SetupS's '\tools\' folder.
%InstalledPath% Same as %AppPath%.
%AppPath% Full path (drive + folder) to the App's or Game's actual installed-to folder.
%AppDrive% drive only of the App's or Game's actual installed-to folder.
%AppFolder% folder only path to the App's or Game's actual installed-to folder.
%CDROM% Same as %CDDRIVE%.
%CDDRIVE% drive only of the system's optical drive (real or virtual).
%LastOSResources% for "%WinDir%\LastOS" (ie, "C:\Windows\LastOS").
The main ones are %AppPath%, %SourcePath%, %ppApps%, %ppGames%, and %Tools%.
But let's take a closer look at the %Tools% (and notice it has related component called %ToolsDrive%). What does this mean actually? SetupS has a function that looks for the nearest available \tools\ folder. Actually, it uses a "tag-file" method because it's looking for a file called "Tools.ico".
So what does this have to do with all this, you wonder. I think what I'm driving at is if you wanted SetupS to break free from a batch-file/.cmd container -- and assuming SetupS is on the same drive as the folder we wanted regenerated -- we should be able to do the following instead (directly from the cmd-line):
Code: Select all
SetupS -Regen %ToolsDrive%\ppAppsLive
or