This commit is contained in:
altalk23 2023-05-01 16:41:03 +03:00
commit b236a1daac
4 changed files with 20 additions and 7 deletions

View file

@ -73,7 +73,7 @@ include(cmake/GeodeFile.cmake)
include(cmake/Platform.cmake)
include(cmake/CPM.cmake)
CPMAddPackage("gh:geode-sdk/json#cef9c64")
CPMAddPackage("gh:geode-sdk/json#19cf6f4")
CPMAddPackage("gh:fmtlib/fmt#9.1.0")
CPMAddPackage("gh:gulrak/filesystem#3e5b930")

View file

@ -1,4 +1,4 @@
set(CPM_DOWNLOAD_VERSION 0.36.0)
set(CPM_DOWNLOAD_VERSION 0.38.1)
if(CPM_SOURCE_CACHE)
set(CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
@ -10,12 +10,24 @@ endif()
# Expand relative path. This is important if the provided path contains a tilde (~)
get_filename_component(CPM_DOWNLOAD_LOCATION ${CPM_DOWNLOAD_LOCATION} ABSOLUTE)
if(NOT (EXISTS ${CPM_DOWNLOAD_LOCATION}))
function(download_cpm)
message(STATUS "Downloading CPM.cmake to ${CPM_DOWNLOAD_LOCATION}")
file(DOWNLOAD
https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake
${CPM_DOWNLOAD_LOCATION}
)
endfunction()
if(NOT (EXISTS ${CPM_DOWNLOAD_LOCATION}))
download_cpm()
else()
# resume download if it previously failed
file(READ ${CPM_DOWNLOAD_LOCATION} check)
if("${check}" STREQUAL "")
download_cpm()
endif()
unset(check)
endif()
include(${CPM_DOWNLOAD_LOCATION})

View file

@ -1,5 +1,6 @@
#include <Windows.h>
#include <iostream>
#include <array>
#include <ghc/filesystem.hpp>
void showError(std::string const& error) {
@ -17,10 +18,10 @@ int loadGeode(PVOID module) {
}
DWORD WINAPI load(PVOID module) {
std::array<TCHAR, MAX_PATH> szFileName;
std::array<TCHAR, MAX_PATH> szFileName;
GetModuleFileName(NULL, szFileName.data(), MAX_PATH);
ghc::filesystem::path path(szFileName);
ghc::filesystem::path path(szFileName.data());
auto workingDir = path.parent_path();
auto updatesDir = workingDir / "geode" / "update";
auto resourcesDir = workingDir / "geode" / "resources";

View file

@ -119,7 +119,7 @@ ghc::filesystem::path dirs::getGameDir() {
std::array<TCHAR, MAX_PATH> szFileName;
GetModuleFileName(NULL, szFileName.data(), MAX_PATH);
ghc::filesystem::path path(szFileName);
ghc::filesystem::path path(szFileName.data());
auto currentPath = path.parent_path();
return currentPath;
}