mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-08 13:04:56 +00:00
Fix macOS/Linux issues
- Fixes png lib becoming undefined on macOS - Auto-detect macports png/Qt paths - Fixes typos - Workaround for AppleClang/fmt bug
This commit is contained in:
@@ -426,7 +426,6 @@ Connection::Connection(int verbosityLevel) {
|
||||
std::string writefds = fmt::format(FMT_STRING("{}"), m_readpipe[1]);
|
||||
std::string vLevel = fmt::format(FMT_STRING("{}"), verbosityLevel);
|
||||
|
||||
/* Try user-specified blender first */
|
||||
if (blenderBin) {
|
||||
execlp(blenderBin->c_str(), blenderBin->c_str(), "--background", "-P", blenderShellPath.c_str(), "--",
|
||||
readfds.c_str(), writefds.c_str(), vLevel.c_str(), blenderAddonPath.c_str(), nullptr);
|
||||
@@ -437,32 +436,6 @@ Connection::Connection(int verbosityLevel) {
|
||||
}
|
||||
}
|
||||
|
||||
/* Try steam */
|
||||
steamBlender = hecl::FindCommonSteamApp("Blender");
|
||||
if (steamBlender.size()) {
|
||||
#ifdef __APPLE__
|
||||
steamBlender += "/blender.app/Contents/MacOS/blender";
|
||||
#else
|
||||
steamBlender += "/blender";
|
||||
#endif
|
||||
execlp(steamBlender.c_str(), steamBlender.c_str(), "--background", "-P", blenderShellPath.c_str(), "--",
|
||||
readfds.c_str(), writefds.c_str(), vLevel.c_str(), blenderAddonPath.c_str(), nullptr);
|
||||
if (errno != ENOENT) {
|
||||
errbuf = fmt::format(FMT_STRING("NOLAUNCH {}"), strerror(errno));
|
||||
_writeStr(errbuf.c_str(), errbuf.size(), m_readpipe[1]);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
/* Otherwise default blender */
|
||||
execlp(DEFAULT_BLENDER_BIN, DEFAULT_BLENDER_BIN, "--background", "-P", blenderShellPath.c_str(), "--",
|
||||
readfds.c_str(), writefds.c_str(), vLevel.c_str(), blenderAddonPath.c_str(), nullptr);
|
||||
if (errno != ENOENT) {
|
||||
errbuf = fmt::format(FMT_STRING("NOLAUNCH {}"), strerror(errno));
|
||||
_writeStr(errbuf.c_str(), errbuf.size(), m_readpipe[1]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* Unable to find blender */
|
||||
_writeStr("NOBLENDER", 9, m_readpipe[1]);
|
||||
exit(1);
|
||||
@@ -490,15 +463,7 @@ Connection::Connection(int verbosityLevel) {
|
||||
BlenderLog.report(logvisor::Fatal, FMT_STRING("Unable to launch blender: {}"), lineStr.c_str() + 9);
|
||||
} else if (!lineStr.compare(0, 9, "NOBLENDER")) {
|
||||
_closePipe();
|
||||
#if _WIN32
|
||||
BlenderLog.report(logvisor::Fatal, FMT_STRING("Unable to find blender at '{}'"), blenderBin.value());
|
||||
#else
|
||||
if (blenderBin)
|
||||
BlenderLog.report(logvisor::Fatal, FMT_STRING("Unable to find blender at '{}' or '{}'"), blenderBin,
|
||||
DEFAULT_BLENDER_BIN);
|
||||
else
|
||||
BlenderLog.report(logvisor::Fatal, FMT_STRING("Unable to find blender at '{}'"), DEFAULT_BLENDER_BIN);
|
||||
#endif
|
||||
BlenderLog.report(logvisor::Fatal, FMT_STRING("Unable to find blender"));
|
||||
} else if (lineStr == "INVALIDBLENDERVER") {
|
||||
_closePipe();
|
||||
BlenderLog.report(logvisor::Fatal, FMT_STRING("Installed blender version must be >= {}.{}"),
|
||||
|
||||
@@ -74,7 +74,7 @@ std::optional<std::string> FindBlender(int& major, int& minor) {
|
||||
}
|
||||
|
||||
#else
|
||||
if (!RegFileExists(blenderBin)) {
|
||||
if (!RegFileExists(blenderBin->c_str())) {
|
||||
/* Try steam */
|
||||
steamBlender = hecl::FindCommonSteamApp("Blender");
|
||||
if (steamBlender.size()) {
|
||||
@@ -84,15 +84,15 @@ std::optional<std::string> FindBlender(int& major, int& minor) {
|
||||
steamBlender += "/blender";
|
||||
#endif
|
||||
blenderBin = steamBlender.c_str();
|
||||
if (!RegFileExists(blenderBin)) {
|
||||
if (!RegFileExists(blenderBin->c_str())) {
|
||||
blenderBin = DEFAULT_BLENDER_BIN;
|
||||
if (!RegFileExists(blenderBin)) {
|
||||
if (!RegFileExists(blenderBin->c_str())) {
|
||||
blenderBin = nullptr;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
blenderBin = DEFAULT_BLENDER_BIN;
|
||||
if (!RegFileExists(blenderBin)) {
|
||||
if (!RegFileExists(blenderBin->c_str())) {
|
||||
blenderBin = nullptr;
|
||||
}
|
||||
}
|
||||
@@ -124,7 +124,7 @@ std::optional<std::string> FindBlender(int& major, int& minor) {
|
||||
delete[] infoData;
|
||||
}
|
||||
#else
|
||||
std::string command = std::string("\"") + blenderBin + "\" --version";
|
||||
std::string command = std::string("\"") + blenderBin.value() + "\" --version";
|
||||
FILE* fp = popen(command.c_str(), "r");
|
||||
char versionBuf[256];
|
||||
size_t rdSize = fread(versionBuf, 1, 255, fp);
|
||||
|
||||
@@ -28,7 +28,9 @@
|
||||
#include <sys/wait.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cpp_lib_ranges
|
||||
#include <ranges>
|
||||
#endif
|
||||
#include <logvisor/logvisor.hpp>
|
||||
|
||||
using namespace std::literals;
|
||||
@@ -37,7 +39,7 @@ namespace hecl {
|
||||
unsigned VerbosityLevel = 0;
|
||||
bool GuiMode = false;
|
||||
logvisor::Module LogModule("hecl");
|
||||
constexpr std::string_view Illegals = "<>?\""sv;
|
||||
constexpr std::string_view Illegals = R"(<>?")";
|
||||
|
||||
void SanitizePath(std::string& path) {
|
||||
if (path.empty())
|
||||
|
||||
Reference in New Issue
Block a user