windows平台代码修正
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include "config.hpp"
|
||||
|
||||
#include "json.hpp"
|
||||
#include "platform.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdlib>
|
||||
@@ -23,7 +24,7 @@ std::filesystem::path home_directory() {
|
||||
#else
|
||||
std::string home = environment("HOME");
|
||||
#endif
|
||||
return home.empty() ? std::filesystem::current_path() : std::filesystem::u8path(home);
|
||||
return home.empty() ? std::filesystem::current_path() : to_path(home);
|
||||
}
|
||||
|
||||
bool local_origin(const std::string& origin) {
|
||||
@@ -37,16 +38,16 @@ bool local_origin(const std::string& origin) {
|
||||
|
||||
std::filesystem::path config_path() {
|
||||
const std::string override_path = environment("SPINE_CONNECTOR_CONFIG");
|
||||
if (!override_path.empty()) return std::filesystem::u8path(override_path);
|
||||
if (!override_path.empty()) return to_path(override_path);
|
||||
#ifdef _WIN32
|
||||
std::string app_data = environment("APPDATA");
|
||||
const auto root = app_data.empty() ? home_directory() : std::filesystem::u8path(app_data);
|
||||
const auto root = app_data.empty() ? home_directory() : to_path(app_data);
|
||||
return root / "SpineParticleConnector" / "config.json";
|
||||
#elif defined(__APPLE__)
|
||||
return home_directory() / "Library" / "Application Support" / "SpineParticleConnector" / "config.json";
|
||||
#else
|
||||
std::string xdg = environment("XDG_CONFIG_HOME");
|
||||
const auto root = xdg.empty() ? home_directory() / ".config" : std::filesystem::u8path(xdg);
|
||||
const auto root = xdg.empty() ? home_directory() / ".config" : to_path(xdg);
|
||||
return root / "spine-particle-connector" / "config.json";
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user