Skip to content

Commit 3b1b64d

Browse files
committed
Fix Bug where config.json opens in System32
1 parent 00c9b6f commit 3b1b64d

File tree

1 file changed

+33
-50
lines changed

1 file changed

+33
-50
lines changed

quickstart.cmd

Lines changed: 33 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
@echo off
2-
setlocal
2+
setlocal EnableExtensions EnableDelayedExpansion
3+
4+
cd /d "%~dp0"
5+
set "SCRIPT_DIR=%~dp0"
36

4-
:: Temporary PowerShell script path
57
set "TEMP_PS=%TEMP%\install_dependencies_temp.ps1"
68

79
(
810
echo $ErrorActionPreference = "Stop"
11+
echo Set-Location "%SCRIPT_DIR%"
12+
echo.
13+
914
echo # ASCII Logo in Red
1015
echo Write-Host " ___. .__ __ _________ __ " -ForegroundColor Red
1116
echo Write-Host "_____ \_ |__ | | _____/ |_ ____ ____ \_ ___ \____________ ____ | | __ ___________ " -ForegroundColor Red
@@ -20,31 +25,24 @@ echo Write-Host "/ \_/. \ | /| \ \___| | \ / \ | |/
2025
echo Write-Host "\_____\ \_/______/ |___|\______ /____|__ \/_______ / |____|\____|__ /____|_ / |____| " -ForegroundColor Red
2126
echo Write-Host " \__> \/ \/ \/ \/ \/ " -ForegroundColor Red
2227
echo Write-Host ""
28+
2329
echo Write-Host "=========================================================" -ForegroundColor White
2430
echo Write-Host " Checking configuration..." -ForegroundColor White
2531
echo Write-Host "=========================================================" -ForegroundColor White
26-
echo.
32+
echo ""
2733

28-
:: Read config.json with manual parsing (compatible with older PowerShell)
2934
echo $skipPythonCheck = $false
3035
echo $skipPythonDependencies = $false
3136
echo if ^(Test-Path "config.json"^) {
3237
echo try {
3338
echo $configContent = Get-Content "config.json" -Raw
34-
echo # Manual JSON parsing for compatibility
35-
echo if ^($configContent -match '"skipPythonCheck"\s*:\s*true'^) {
36-
echo $skipPythonCheck = $true
37-
echo }
38-
echo if ^($configContent -match '"skipPythonDependencies"\s*:\s*true'^) {
39-
echo $skipPythonDependencies = $true
40-
echo }
39+
echo if ^($configContent -match '"skipPythonCheck"\s*:\s*true'^) { $skipPythonCheck = $true }
40+
echo if ^($configContent -match '"skipPythonDependencies"\s*:\s*true'^) { $skipPythonDependencies = $true }
4141
echo } catch {
42-
echo Write-Host "Warning: Error reading config.json, using default settings" -ForegroundColor Yellow
42+
echo Write-Host "Warning: Error reading config.json, using defaults" -ForegroundColor Yellow
4343
echo }
4444
echo }
45-
echo.
4645

47-
:: Check if Python exists (unless skipped)
4846
echo if ^(-not $skipPythonCheck^) {
4947
echo Write-Host ""
5048
echo Write-Host "=========================================================" -ForegroundColor White
@@ -54,7 +52,7 @@ echo $pythonPath = ^(Get-Command python -ErrorAction SilentlyContinue^).Sour
5452
echo if ^(-not $pythonPath^) {
5553
echo Write-Host "Python not found. Installing via winget..." -ForegroundColor White
5654
echo if ^(-not ^(Get-Command winget -ErrorAction SilentlyContinue^)^) {
57-
echo Write-Host "ERROR: winget not available. Install Windows Package Manager first." -ForegroundColor Red
55+
echo Write-Host "ERROR: winget not available." -ForegroundColor Red
5856
echo exit 1
5957
echo }
6058
echo winget install --id Python.Python.3 -e --source winget
@@ -63,70 +61,55 @@ echo if ^(-not $pythonPath^) {
6361
echo Write-Host "ERROR: Python installation failed." -ForegroundColor Red
6462
echo exit 1
6563
echo }
66-
echo Write-Host 'Python installed successfully.' -ForegroundColor Green
6764
echo } else {
68-
echo Write-Host 'Python is already installed at: ' + $pythonPath -ForegroundColor Green
65+
echo Write-Host "Python found: $pythonPath" -ForegroundColor Green
6966
echo }
7067
echo } else {
71-
echo Write-Host "Skipping Python check as per config.json" -ForegroundColor Yellow
68+
echo Write-Host "Skipping Python check (config.json)" -ForegroundColor Yellow
7269
echo $pythonPath = ^(Get-Command python -ErrorAction SilentlyContinue^).Source
7370
echo }
7471

7572
echo if ^(-not $skipPythonDependencies^) {
7673
echo if ^($pythonPath^) {
7774
echo Write-Host ""
78-
echo Write-Host "Installing required Python packages: cryptography, colorama..." -ForegroundColor White
79-
echo Write-Host ""
80-
echo Write-Host "Upgrading pip..." -ForegroundColor Gray
75+
echo Write-Host "Installing Python dependencies..." -ForegroundColor White
8176
echo ^& $pythonPath -m pip install --upgrade pip
82-
echo Write-Host "Installing required Python packages: cryptography, colorama..." -ForegroundColor Gray
8377
echo ^& $pythonPath -m pip install cryptography colorama
84-
echo if ^($LASTEXITCODE -eq 0^) {
85-
echo Write-Host ""
86-
echo Write-Host "=========================================================" -ForegroundColor Green
87-
echo Write-Host " Python and required packages installed successfully!" -ForegroundColor Green
88-
echo Write-Host "=========================================================" -ForegroundColor Green
89-
echo Write-Host ""
90-
echo } else {
91-
echo Write-Host "ERROR: Failed to install one or more packages." -ForegroundColor Red
92-
echo }
9378
echo } else {
94-
echo Write-Host "ERROR: Python not found and cannot install dependencies." -ForegroundColor Red
79+
echo Write-Host "ERROR: Python not found." -ForegroundColor Red
9580
echo }
9681
echo } else {
97-
echo Write-Host "Skipping Python dependencies installation as per config.json" -ForegroundColor Yellow
82+
echo Write-Host "Skipping Python dependencies (config.json)" -ForegroundColor Yellow
9883
echo }
9984

100-
:: Ask to run patcher
85+
echo Write-Host ""
10186
echo Write-Host "=========================================================" -ForegroundColor White
10287
echo Write-Host " Dependencies installed!" -ForegroundColor DarkGreen
10388
echo Write-Host "=========================================================" -ForegroundColor White
104-
echo Write-Host ""
105-
echo $runPatcher = Read-Host "Do you want to run the edit the config.json? (Needed for first run) (y/n)"
106-
echo if ($runPatcher -eq "y" -or $runPatcher -eq "Y"^) {
107-
echo Write-Host "Opening config.json in Notepad..." -ForegroundColor Green
108-
echo Start-Process notepad.exe -ArgumentList "config.json"
89+
echo ""
90+
91+
echo $editConfig = Read-Host "Edit config.json now? (y/n)"
92+
echo if ^($editConfig -match '^[Yy]'^) {
93+
echo notepad "$PWD\config.json"
10994
echo }
110-
echo $runPatcher = Read-Host "Do you want to run the patcher now? (y/n)"
111-
echo if ^($runPatcher -eq "y" -or $runPatcher -eq "Y"^) {
95+
96+
echo $runPatcher = Read-Host "Run patcher now? (y/n)"
97+
echo if ^($runPatcher -match '^[Yy]'^) {
11298
echo if ^($pythonPath^) {
11399
echo Write-Host "Running patcher..." -ForegroundColor Green
114-
echo ^& $pythonPath abletonCracker.py
100+
echo ^& $pythonPath "$PWD\abletonCracker.py"
115101
echo } else {
116-
echo Write-Host "ERROR: Python not found. Cannot run patcher." -ForegroundColor Red
102+
echo Write-Host "ERROR: Python not found." -ForegroundColor Red
117103
echo }
104+
echo } else {
105+
echo Write-Host "Run later with: python abletonCracker.py" -ForegroundColor Yellow
118106
echo }
119-
echo else {
120-
echo Write-Host "You can run the patcher later by executing: python abletonCracker.py" -ForegroundColor Yellow
121-
echo Write-Host "You can also always undo the patch by running: python abletonCracker.py --undo" -ForegroundColor Yellow
122-
echo }
107+
123108
) > "%TEMP_PS%"
124109

125-
:: Run the PowerShell script with execution policy bypass
126110
powershell -NoProfile -ExecutionPolicy Bypass -File "%TEMP_PS%"
127111

128-
:: Delete temporary script
129112
del "%TEMP_PS%" >nul 2>&1
130113

131114
pause
132-
exit /b 0
115+
exit /b 0

0 commit comments

Comments
 (0)