diff --git a/include/common.hpp b/include/common.hpp index 4d5f3c10..cb15413f 100644 --- a/include/common.hpp +++ b/include/common.hpp @@ -258,7 +258,6 @@ extern const std::string APP_EDITION; extern const std::string APP_EDITION_NAME; extern const std::string APP_VERSION_MAJOR; extern const std::string APP_VERSION; -extern const std::string APP_OS; extern const std::string APP_ARCH; extern const std::string API_URL; diff --git a/src/common.cpp b/src/common.cpp index d6f0ba2d..4cac7aa9 100644 --- a/src/common.cpp +++ b/src/common.cpp @@ -20,19 +20,21 @@ const std::string APP_EDITION = "Free"; const std::string APP_EDITION_NAME = "Free"; const std::string APP_VERSION_MAJOR = "2"; const std::string APP_VERSION = TOSTRING(_APP_VERSION); +const std::string APP_ARCH = #if defined ARCH_WIN - const std::string APP_OS = "win"; -#elif ARCH_MAC - const std::string APP_OS = "mac"; + "win" +#elif defined ARCH_MAC + "mac" #elif defined ARCH_LIN - const std::string APP_OS = "lin"; + "lin" #endif + "-" #if defined ARCH_X64 - const std::string APP_ARCH = "x64"; -#endif -#if defined ARCH_ARM64 - const std::string APP_ARCH = "arm64"; + "x64" +#elif defined ARCH_ARM64 + "arm64" #endif + ; const std::string API_URL = "https://api.vcvrack.com"; diff --git a/src/library.cpp b/src/library.cpp index 2e34eeee..de70e5c4 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -90,7 +90,7 @@ void checkAppUpdate() { json_t* downloadUrlsJ = json_object_get(resJ, "downloadUrls"); if (downloadUrlsJ) { - json_t* downloadUrlJ = json_object_get(downloadUrlsJ, APP_OS.c_str()); + json_t* downloadUrlJ = json_object_get(downloadUrlsJ, APP_ARCH.c_str()); if (downloadUrlJ) appDownloadUrl = json_string_value(downloadUrlJ); } @@ -351,16 +351,16 @@ void syncUpdate(std::string slug) { updateProgress = 0.f; DEFER({updateProgress = 0.f;}); - INFO("Downloading plugin %s v%s for %s", slug.c_str(), update.version.c_str(), APP_OS.c_str()); + INFO("Downloading plugin %s v%s for %s", slug.c_str(), update.version.c_str(), APP_ARCH.c_str()); // Get download URL std::string downloadUrl = API_URL + "/download"; downloadUrl += "?slug=" + network::encodeUrl(slug); downloadUrl += "&version=" + network::encodeUrl(update.version); - downloadUrl += "&os=" + network::encodeUrl(APP_OS); + downloadUrl += "&os=" + network::encodeUrl(APP_ARCH); // Get file path - std::string packageFilename = slug + "-" + update.version + "-" + APP_OS + ".vcvplugin"; + std::string packageFilename = slug + "-" + update.version + "-" + APP_ARCH + ".vcvplugin"; std::string packagePath = system::join(plugin::pluginsPath, packageFilename); // Download plugin package