Skip to content
This repository has been archived by the owner on Aug 15, 2024. It is now read-only.

Commit

Permalink
Installation fixes for MacOS and Windows.
Browse files Browse the repository at this point in the history
Fixed compatibility with the new Celeste version on MacOS.
Windows installer now uses Julia 1.6.0.
  • Loading branch information
Cruor authored and Vexatos committed Apr 2, 2021
1 parent 20768bb commit f71bfdd
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 23 deletions.
14 changes: 7 additions & 7 deletions ahorn.bat
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
@echo off
setlocal EnableDelayedExpansion

set minimum_version="v\"1.3.0\""
set julia_url_64bit=https://julialang-s3.julialang.org/bin/winnt/x64/1.5/julia-1.5.2-win64.exe
set julia_url_32bit=https://julialang-s3.julialang.org/bin/winnt/x86/1.5/julia-1.5.2-win32.exe
set julia_filename=julia-1.5.2-installed.exe
set minimum_version="v\"1.6.0\""
set julia_url_64bit=https://julialang-s3.julialang.org/bin/winnt/x64/1.6/julia-1.6.0-win64.exe
set julia_url_32bit=https://julialang-s3.julialang.org/bin/winnt/x86/1.6/julia-1.6.0-win32.exe
set julia_filename=julia-1.6.0-installer.exe
set install_url=https://raw.githubusercontent.com/CelestialCartographers/Ahorn/master/install_ahorn.jl
set install_filename=install_ahorn.jl

Expand Down Expand Up @@ -152,8 +152,8 @@ if %ERRORLEVEL% neq 0 (
set /p "confirmJuliaInstall=Do you want to install a compatible version of Julia? [y/N]: "
IF /I "!confirmJuliaInstall!" equ "y" (
echo Downloading compatible Julia version and starting the installer.
echo Install it into the default directory unless you want to manually add julia to the PATH environment variable.
echo Make sure to restart the script after adding julia to the PATH if you are using a custom location.
echo By default this adds Julia to the PATH environment variable, allowing installation to any directory.
echo If you wish to manually add Julia to PATH you can uncheck the option in the installer.

echo Downloading installer

Expand All @@ -173,7 +173,7 @@ if %ERRORLEVEL% neq 0 (
)

echo Running installer
start /wait "" "%~dp0%julia_filename%"
start /wait "" "%~dp0%julia_filename%" /TASKS="addtopath"

del "%~dp0%julia_filename%"

Expand Down
43 changes: 27 additions & 16 deletions src/init_ahorn.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ end
function findSteamInstallDir()
if Sys.iswindows()
try
# 64bit
# 64bit
return querykey(WinReg.HKEY_LOCAL_MACHINE, "SOFTWARE\\WOW6432Node\\Valve\\Steam", "InstallPath")

catch e
Expand All @@ -27,6 +27,7 @@ function findSteamInstallDir()
joinpath(homedir(), ".local", "share", "Steam"),
joinpath(homedir(), ".steam", "steam")
]

for path in linuxSteamDirs
if isdir(path)
return path
Expand All @@ -35,13 +36,37 @@ function findSteamInstallDir()
end
end

function cleanupPath(path)
filename = basename(path)

if lowercase(filename) == "celeste.exe"
return dirname(path)
end

if Sys.isapple() && lowercase(filename) == "celeste.app"
celesteContentDirs = [
joinpath(path, "Contents", "Resources"), # Celeste 1.3.3.0 and newer
joinpath(path, "Contents", "MacOS") # Before Celeste 1.3.3.0
]

for path in celesteContentDirs
if isdir(path)
return path
end
end
end

return path
end

function findCelesteDir()
steam = findSteamInstallDir()

if steam !== nothing
celesteDir = joinpath(steam, "steamapps", "common", "Celeste")

if Sys.isapple()
celesteDir = joinpath(celesteDir, "Celeste.app", "Contents", "MacOS")
celesteDir = cleanupPath(joinpath(celesteDir, "Celeste.app"))
end

if isdir(celesteDir)
Expand All @@ -52,20 +77,6 @@ function findCelesteDir()
return false, ""
end

function cleanupPath(path)
filename = basename(path)

if lowercase(filename) == "celeste.exe"
return dirname(path)
end

if Sys.isapple() && lowercase(filename) == "celeste.app"
return joinpath(path, "Contents", "MacOS")
end

return path
end

function configureCelesteDir()
if !haskey(config, "celeste_dir")
found, celesteDir = findCelesteDir()
Expand Down

0 comments on commit f71bfdd

Please sign in to comment.