Skip to content

Commit

Permalink
patch switch: wrong prefs path
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexDeFoc committed Aug 4, 2024
1 parent 03c4a4d commit a7b61f1
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 14 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
archive/
export/
2 changes: 1 addition & 1 deletion Source/switch.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
)

func main(){
err := copy("../prefs", getPrefsPath())
err := copy("prefs", getPrefsPath())
if err != nil {
log.Panic(err)
}
Expand Down
46 changes: 33 additions & 13 deletions build.bat
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
@echo off
cls
setlocal enabledelayedexpansion

:: Define the targets for all relevant platforms
set targets=linux/amd64 linux/386 linux/arm linux/arm64 darwin/amd64 darwin/arm64 windows/amd64 windows/386 windows/arm windows/arm64
set sources=main.go Source/switch.go

:: Copy the config file to each platform's Source folder
:: Ensure the export folder exists
if not exist "export" mkdir "export"

:: Loop through each target platform
for %%t in (%targets%) do (
for /f "tokens=1,2 delims=/" %%a in ("%%t") do (
set GOOS=%%a
set GOARCH=%%b

:: Create platform directories if they don't exist
:: Create platform directories inside export if they don't exist
if not exist "export/%%a-%%b" mkdir "export/%%a-%%b"
if not exist "Source/%%a-%%b/Source" mkdir "Source/%%a-%%b/Source"
if not exist "export/%%a-%%b/Source" mkdir "export/%%a-%%b/Source"

:: Copy the config file to the Source folder
:: copy "config" "main/%%a-%%b\config"
:: Copy the config file to the Source folder inside the platform folder
copy "config" "export/%%a-%%b/Source\config"

:: Set output extension for Windows
set output_ext=
Expand All @@ -30,15 +34,31 @@ for %%t in (%targets%) do (
set GOARCH=%%b
go build -o "export/%%a-%%b/main!output_ext!" main.go

:: Build switch.go in Source folder
echo Building switch.go in Source folder for %%a/%%b...
pushd Source
set GOOS=%%a
set GOARCH=%%b
go build -o "..\Source\%%a-%%b\Source\switch!output_ext!" switch.go
popd
:: Set the target directory for switch.go
set target_dir=export\%%a-%%b\Source

:: Check if the target directory exists and build switch.go
if exist "!target_dir!" (
echo Changing directory to Source
pushd Source
if not errorlevel 1 (
echo Building switch.go in !target_dir!
go build -o "..\!target_dir!\switch!output_ext!" switch.go
echo Finished building switch.go
) else (
echo Failed to change directory to Source
)
echo Returning to original directory
popd
) else (
echo Error: Directory "!target_dir!" does not exist.
)

:: Formatting line to separate output for each platform
echo.
echo --------------------------------------------------
echo.
)
)

echo Build process completed.

0 comments on commit a7b61f1

Please sign in to comment.