-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstart.ps1
More file actions
88 lines (75 loc) · 2.9 KB
/
start.ps1
File metadata and controls
88 lines (75 loc) · 2.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# qModMaster Start Script for Windows PowerShell
# This script sets up the environment and starts qModMaster on Windows
Write-Host "Starting qModMaster on Windows..." -ForegroundColor Green
# Get the directory where this script is located
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
Set-Location $ScriptDir
# Check for Qt installation in common locations
$QtFound = $false
$QtPaths = @(
"C:\Qt",
"$env:USERPROFILE\Qt",
"$env:ProgramFiles\Qt",
"${env:ProgramFiles(x86)}\Qt"
)
foreach ($QtBase in $QtPaths) {
if (Test-Path $QtBase) {
# Try to find Qt versions (prefer Qt 6.x, then Qt 5.x)
$QtVersions = Get-ChildItem -Path $QtBase -Directory | Where-Object { $_.Name -match '^\d+\.\d+' } | Sort-Object {
# Sort: Qt 6.x first, then Qt 5.x, then others
$major = [int]($_.Name -split '\.')[0]
if ($major -eq 6) { "0" + $_.Name }
elseif ($major -eq 5) { "1" + $_.Name }
else { "2" + $_.Name }
}
foreach ($QtVersion in $QtVersions) {
$QtPathsToCheck = @(
"$QtBase\$($QtVersion.Name)\msvc2019_64",
"$QtBase\$($QtVersion.Name)\msvc2022_64",
"$QtBase\$($QtVersion.Name)\mingw_64",
"$QtBase\$($QtVersion.Name)\msvc2019_32",
"$QtBase\$($QtVersion.Name)\mingw_32"
)
foreach ($QtPath in $QtPathsToCheck) {
if (Test-Path "$QtPath\bin\qmake.exe") {
$env:PATH = "$QtPath\bin;$env:PATH"
$env:QT_PLUGIN_PATH = "$QtPath\plugins"
$QtFound = $true
$majorVersion = [int]($QtVersion.Name -split '\.')[0]
if ($majorVersion -ge 6) {
Write-Host "Found Qt $($QtVersion.Name) at: $QtPath" -ForegroundColor Cyan
} else {
Write-Host "Found Qt $($QtVersion.Name) at: $QtPath" -ForegroundColor Yellow
}
break
}
}
if ($QtFound) { break }
}
if ($QtFound) { break }
}
}
# Start the application
$ExePaths = @(
"qModMaster.exe",
"qModMaster\qModMaster.exe",
"release\qModMaster.exe",
"debug\qModMaster.exe"
)
$ExeFound = $false
foreach ($ExePath in $ExePaths) {
if (Test-Path $ExePath) {
Write-Host "Starting $ExePath..." -ForegroundColor Green
Start-Process -FilePath $ExePath -WorkingDirectory $ScriptDir
$ExeFound = $true
break
}
}
if (-not $ExeFound) {
Write-Host "Error: qModMaster executable not found!" -ForegroundColor Red
Write-Host "Please build the project first using: qmake && nmake" -ForegroundColor Yellow
Read-Host "Press Enter to exit"
exit 1
}
Write-Host "qModMaster started successfully!" -ForegroundColor Green
Start-Sleep -Seconds 2