Browse Source

Split APP_ARCH to APP_OS and APP_CPU.

tags/v2.2.2
Andrew Belt 1 year ago
parent
commit
d8eba3b982
4 changed files with 13 additions and 14 deletions
  1. +1
    -1
      adapters/standalone.cpp
  2. +2
    -1
      include/common.hpp
  3. +5
    -8
      src/common.cpp
  4. +5
    -4
      src/library.cpp

+ 1
- 1
adapters/standalone.cpp View File

@@ -108,7 +108,7 @@ int main(int argc, char* argv[]) {
asset::userDir = optarg;
} break;
case 'v': {
std::fprintf(stderr, "%s %s %s %s\n", APP_NAME.c_str(), APP_EDITION_NAME.c_str(), APP_VERSION.c_str(), APP_ARCH.c_str());
std::fprintf(stderr, "%s %s %s %s-%s\n", APP_NAME.c_str(), APP_EDITION_NAME.c_str(), APP_VERSION.c_str(), APP_OS.c_str(), APP_CPU.c_str());
return 0;
}
// Mac "app translocation" passes a nonsense -psn_... flag, so -p is reserved.


+ 2
- 1
include/common.hpp View File

@@ -258,7 +258,8 @@ 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_ARCH;
extern const std::string APP_OS;
extern const std::string APP_CPU;
extern const std::string API_URL;




+ 5
- 8
src/common.cpp View File

@@ -20,21 +20,18 @@ 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
"win"
const std::string APP_OS = "win";
#elif defined ARCH_MAC
"mac"
const std::string APP_OS = "mac";
#elif defined ARCH_LIN
"lin"
const std::string APP_OS = "lin";
#endif
"-"
#if defined ARCH_X64
"x64"
const std::string APP_CPU = "x64";
#elif defined ARCH_ARM64
"arm64"
const std::string APP_CPU = "arm64";
#endif
;
const std::string API_URL = "https://api.vcvrack.com";




+ 5
- 4
src/library.cpp View File

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

json_t* downloadUrlsJ = json_object_get(resJ, "downloadUrls");
if (downloadUrlsJ) {
json_t* downloadUrlJ = json_object_get(downloadUrlsJ, APP_ARCH.c_str());
std::string arch = APP_OS + "-" + APP_CPU;
json_t* downloadUrlJ = json_object_get(downloadUrlsJ, arch.c_str());
if (downloadUrlJ)
appDownloadUrl = json_string_value(downloadUrlJ);
}
@@ -351,16 +352,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_ARCH.c_str());
INFO("Downloading plugin %s v%s for %s-%s", slug.c_str(), update.version.c_str(), APP_OS.c_str(), APP_CPU.c_str());

// Get download URL
std::string downloadUrl = API_URL + "/download";
downloadUrl += "?slug=" + network::encodeUrl(slug);
downloadUrl += "&version=" + network::encodeUrl(update.version);
downloadUrl += "&arch=" + network::encodeUrl(APP_ARCH);
downloadUrl += "&arch=" + network::encodeUrl(APP_OS + "-" + APP_CPU);

// Get file path
std::string packageFilename = slug + "-" + update.version + "-" + APP_ARCH + ".vcvplugin";
std::string packageFilename = slug + "-" + update.version + "-" + APP_OS + "-" + APP_CPU + ".vcvplugin";
std::string packagePath = system::join(plugin::pluginsPath, packageFilename);

// Download plugin package


Loading…
Cancel
Save