You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

77 lines
1.8KB

  1. /*
  2. * DISTRHO Cardinal Plugin
  3. * Copyright (C) 2021-2024 Filipe Coelho <falktx@falktx.com>
  4. * SPDX-License-Identifier: GPL-3.0-or-later
  5. */
  6. /**
  7. * This file is an edited version of VCVRack's common.cpp
  8. * Copyright (C) 2016-2023 VCV.
  9. *
  10. * This program is free software: you can redistribute it and/or
  11. * modify it under the terms of the GNU General Public License as
  12. * published by the Free Software Foundation; either version 3 of
  13. * the License, or (at your option) any later version.
  14. */
  15. #include <common.hpp>
  16. #include <string.hpp>
  17. #ifdef NDEBUG
  18. # undef DEBUG
  19. #endif
  20. #include "DistrhoPluginUtils.hpp"
  21. #if defined(ARCH_WIN)
  22. #include <windows.h>
  23. FILE* fopen_u8(const char* filename, const char* mode) {
  24. if (FILE* const f = _wfopen(rack::string::UTF8toUTF16(filename).c_str(), rack::string::UTF8toUTF16(mode).c_str()))
  25. return f;
  26. if (std::strncmp(filename, "\\\\?\\", 4) == 0 && std::getenv("CARDINAL_UNDER_WINE") != nullptr)
  27. return _wfopen(L"Z:\\dev\\null", rack::string::UTF8toUTF16(mode).c_str());
  28. return nullptr;
  29. }
  30. #elif defined(DISTRHO_OS_WASM)
  31. #include <sys/stat.h>
  32. #undef fopen
  33. FILE* fopen_wasm(const char* filename, const char* mode) {
  34. chmod(filename, 0777);
  35. return std::fopen(filename, mode);
  36. }
  37. #endif
  38. namespace rack {
  39. const std::string APP_NAME = "Cardinal";
  40. const std::string APP_EDITION = getPluginFormatName();
  41. const std::string APP_EDITION_NAME = "Audio Plugin";
  42. const std::string APP_VERSION_MAJOR = "2";
  43. const std::string APP_VERSION = "2.4.1";
  44. #if defined ARCH_WIN
  45. const std::string APP_OS = "win";
  46. #elif defined ARCH_MAC
  47. const std::string APP_OS = "mac";
  48. #elif defined ARCH_LIN
  49. const std::string APP_OS = "lin";
  50. #else
  51. #error ARCH_LIN undefined
  52. #endif
  53. const std::string API_URL = "";
  54. Exception::Exception(const char* format, ...) {
  55. va_list args;
  56. va_start(args, format);
  57. msg = string::fV(format, args);
  58. va_end(args);
  59. }
  60. } // namespace rack