Skip to content

Commit

Permalink
Moved folder creation directory up so it creates the directory first …
Browse files Browse the repository at this point in the history
…and then downloads everything
  • Loading branch information
IMXNOOBX committed Apr 10, 2024
1 parent aca360b commit 9a37957
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions installer/installer.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ set "repoUrl=https://api.github.com/repos/IMXNOOBX/ghost/releases/latest"
set "installPath=%APPDATA%\Ghost"
set "shortcutPath=%APPDATA%\Microsoft\Windows\Start Menu\Programs\Ghost.lnk"

rem Create installation directory if it doesn't exist
if not exist "%installPath%" mkdir "%installPath%"

rem Download latest release from GitHub
powershell -Command "$response = Invoke-WebRequest -Uri '%repoUrl%' -UseBasicParsing; if ($response.StatusCode -eq 200) { $downloadUrl = ($response.Content | ConvertFrom-Json).assets.browser_download_url; Invoke-WebRequest -Uri $downloadUrl -OutFile '%installPath%\temp.zip'; if ($?) { exit 0 } else { exit 1 } } else { exit 1 }"

Expand All @@ -15,9 +18,6 @@ if %errorlevel% neq 0 (
exit /b 1
)

rem Create installation directory if it doesn't exist
if not exist "%installPath%" mkdir "%installPath%"

rem Extract files to destination
powershell -Command "Expand-Archive -Path '%installPath%\temp.zip' -DestinationPath '%installPath%' -Force"

Expand Down

0 comments on commit 9a37957

Please sign in to comment.