Browse Source

Merge APP_OS variable into APP_ARCH.

tags/v2.2.0
Andrew Belt 2 years ago
parent
commit
8916e3b383
3 changed files with 14 additions and 13 deletions
  1. +0
    -1
      include/common.hpp
  2. +10
    -8
      src/common.cpp
  3. +4
    -4
      src/library.cpp

+ 0
- 1
include/common.hpp View File

@@ -258,7 +258,6 @@ extern const std::string APP_EDITION;
extern const std::string APP_EDITION_NAME; extern const std::string APP_EDITION_NAME;
extern const std::string APP_VERSION_MAJOR; extern const std::string APP_VERSION_MAJOR;
extern const std::string APP_VERSION; extern const std::string APP_VERSION;
extern const std::string APP_OS;
extern const std::string APP_ARCH; extern const std::string APP_ARCH;
extern const std::string API_URL; extern const std::string API_URL;




+ 10
- 8
src/common.cpp View File

@@ -20,19 +20,21 @@ const std::string APP_EDITION = "Free";
const std::string APP_EDITION_NAME = "Free"; const std::string APP_EDITION_NAME = "Free";
const std::string APP_VERSION_MAJOR = "2"; const std::string APP_VERSION_MAJOR = "2";
const std::string APP_VERSION = TOSTRING(_APP_VERSION); const std::string APP_VERSION = TOSTRING(_APP_VERSION);
const std::string APP_ARCH =
#if defined ARCH_WIN #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 #elif defined ARCH_LIN
const std::string APP_OS = "lin";
"lin"
#endif #endif
"-"
#if defined ARCH_X64 #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 #endif
;
const std::string API_URL = "https://api.vcvrack.com"; const std::string API_URL = "https://api.vcvrack.com";






+ 4
- 4
src/library.cpp View File

@@ -90,7 +90,7 @@ void checkAppUpdate() {


json_t* downloadUrlsJ = json_object_get(resJ, "downloadUrls"); json_t* downloadUrlsJ = json_object_get(resJ, "downloadUrls");
if (downloadUrlsJ) { 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) if (downloadUrlJ)
appDownloadUrl = json_string_value(downloadUrlJ); appDownloadUrl = json_string_value(downloadUrlJ);
} }
@@ -351,16 +351,16 @@ void syncUpdate(std::string slug) {
updateProgress = 0.f; updateProgress = 0.f;
DEFER({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 // Get download URL
std::string downloadUrl = API_URL + "/download"; std::string downloadUrl = API_URL + "/download";
downloadUrl += "?slug=" + network::encodeUrl(slug); downloadUrl += "?slug=" + network::encodeUrl(slug);
downloadUrl += "&version=" + network::encodeUrl(update.version); downloadUrl += "&version=" + network::encodeUrl(update.version);
downloadUrl += "&os=" + network::encodeUrl(APP_OS);
downloadUrl += "&os=" + network::encodeUrl(APP_ARCH);


// Get file path // 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); std::string packagePath = system::join(plugin::pluginsPath, packageFilename);


// Download plugin package // Download plugin package


Loading…
Cancel
Save