@@ -108,7 +108,7 @@ int main(int argc, char* argv[]) { | |||||
asset::userDir = optarg; | asset::userDir = optarg; | ||||
} break; | } break; | ||||
case 'v': { | 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; | return 0; | ||||
} | } | ||||
// Mac "app translocation" passes a nonsense -psn_... flag, so -p is reserved. | // Mac "app translocation" passes a nonsense -psn_... flag, so -p is reserved. | ||||
@@ -258,7 +258,8 @@ 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_ARCH; | |||||
extern const std::string APP_OS; | |||||
extern const std::string APP_CPU; | |||||
extern const std::string API_URL; | extern const std::string API_URL; | ||||
@@ -20,21 +20,18 @@ 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 | ||||
"win" | |||||
const std::string APP_OS = "win"; | |||||
#elif defined ARCH_MAC | #elif defined ARCH_MAC | ||||
"mac" | |||||
const std::string APP_OS = "mac"; | |||||
#elif defined ARCH_LIN | #elif defined ARCH_LIN | ||||
"lin" | |||||
const std::string APP_OS = "lin"; | |||||
#endif | #endif | ||||
"-" | |||||
#if defined ARCH_X64 | #if defined ARCH_X64 | ||||
"x64" | |||||
const std::string APP_CPU = "x64"; | |||||
#elif defined ARCH_ARM64 | #elif defined ARCH_ARM64 | ||||
"arm64" | |||||
const std::string APP_CPU = "arm64"; | |||||
#endif | #endif | ||||
; | |||||
const std::string API_URL = "https://api.vcvrack.com"; | const std::string API_URL = "https://api.vcvrack.com"; | ||||
@@ -90,7 +90,8 @@ 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_ARCH.c_str()); | |||||
std::string arch = APP_OS + "-" + APP_CPU; | |||||
json_t* downloadUrlJ = json_object_get(downloadUrlsJ, arch.c_str()); | |||||
if (downloadUrlJ) | if (downloadUrlJ) | ||||
appDownloadUrl = json_string_value(downloadUrlJ); | appDownloadUrl = json_string_value(downloadUrlJ); | ||||
} | } | ||||
@@ -351,16 +352,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_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 | // 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 += "&arch=" + network::encodeUrl(APP_ARCH); | |||||
downloadUrl += "&arch=" + network::encodeUrl(APP_OS + "-" + APP_CPU); | |||||
// Get file path | // 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); | std::string packagePath = system::join(plugin::pluginsPath, packageFilename); | ||||
// Download plugin package | // Download plugin package | ||||