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.

91 lines
2.5KB

  1. /*
  2. * DISTRHO Cardinal Plugin
  3. * Copyright (C) 2021-2023 Filipe Coelho <falktx@falktx.com>
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License as
  7. * published by the Free Software Foundation; either version 3 of
  8. * the License, or any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * For a full copy of the GNU General Public License see the LICENSE file.
  16. */
  17. /**
  18. * This file is an edited version of VCVRack's common.cpp
  19. * Copyright (C) 2016-2023 VCV.
  20. *
  21. * This program is free software: you can redistribute it and/or
  22. * modify it under the terms of the GNU General Public License as
  23. * published by the Free Software Foundation; either version 3 of
  24. * the License, or (at your option) any later version.
  25. */
  26. #include <common.hpp>
  27. #include <string.hpp>
  28. #ifdef NDEBUG
  29. # undef DEBUG
  30. #endif
  31. #include "DistrhoPluginUtils.hpp"
  32. #if defined(ARCH_WIN)
  33. #include <windows.h>
  34. FILE* fopen_u8(const char* filename, const char* mode) {
  35. if (FILE* const f = _wfopen(rack::string::UTF8toUTF16(filename).c_str(), rack::string::UTF8toUTF16(mode).c_str()))
  36. return f;
  37. if (std::strncmp(filename, "\\\\?\\", 4) == 0 && std::getenv("CARDINAL_UNDER_WINE") != nullptr)
  38. return _wfopen(L"Z:\\dev\\null", rack::string::UTF8toUTF16(mode).c_str());
  39. return nullptr;
  40. }
  41. #elif defined(DISTRHO_OS_WASM)
  42. #include <sys/stat.h>
  43. #undef fopen
  44. FILE* fopen_wasm(const char* filename, const char* mode) {
  45. chmod(filename, 0777);
  46. return std::fopen(filename, mode);
  47. }
  48. #endif
  49. namespace rack {
  50. const std::string APP_NAME = "Cardinal";
  51. const std::string APP_EDITION = getPluginFormatName();
  52. const std::string APP_EDITION_NAME = "Audio Plugin";
  53. const std::string APP_VERSION_MAJOR = "2";
  54. const std::string APP_VERSION = "2.3.0";
  55. #if defined ARCH_WIN
  56. const std::string APP_OS = "win";
  57. const std::string APP_OS_NAME = "Windows";
  58. #elif defined ARCH_MAC
  59. const std::string APP_OS = "mac";
  60. const std::string APP_OS_NAME = "macOS";
  61. #elif defined ARCH_LIN
  62. const std::string APP_OS = "lin";
  63. const std::string APP_OS_NAME = "Linux";
  64. #else
  65. #error ARCH_LIN undefined
  66. #endif
  67. const std::string API_URL = "";
  68. Exception::Exception(const char* format, ...) {
  69. va_list args;
  70. va_start(args, format);
  71. msg = string::fV(format, args);
  72. va_end(args);
  73. }
  74. } // namespace rack