Other platforms for SteamFinder

This commit is contained in:
Jack Andersen 2017-07-23 13:44:17 -10:00
parent 14277fa386
commit f761810e8c
3 changed files with 23 additions and 1 deletions

View File

@ -4,6 +4,7 @@
#ifndef _WIN32
#include <stdlib.h>
#include <unistd.h>
#include <sys/stat.h>
#else
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN 1

View File

@ -440,6 +440,27 @@ BlenderConnection::BlenderConnection(int verbosityLevel)
}
}
/* Try steam */
steamBlender = hecl::FindCommonSteamApp(_S("Blender"));
if (steamBlender.size())
{
#ifdef __APPLE__
steamBlender += "/blender.app/Contents/MacOS/blender";
#else
steamBlender += "/blender";
#endif
blenderBin = steamBlender.c_str();
execlp(blenderBin, blenderBin,
"--background", "-P", blenderShellPath.c_str(),
"--", readfds, writefds, vLevel, blenderAddonPath.c_str(), NULL);
if (errno != ENOENT)
{
snprintf(errbuf, 256, "NOLAUNCH %s", strerror(errno));
_writeStr(errbuf, strlen(errbuf), m_readpipe[1]);
exit(1);
}
}
/* Otherwise default blender */
execlp(DEFAULT_BLENDER_BIN, DEFAULT_BLENDER_BIN,
"--background", "-P", blenderShellPath.c_str(),

View File

@ -11,7 +11,7 @@ namespace hecl
{
/* Used to extract alternate steam install directories from libraryfolders.vdf */
static const std::regex regSteamPath("^\\s+\\\"[0-9]+\\\"\\s+\\\"(.*)\\\"",
static const std::regex regSteamPath(R"(^\s+\"[0-9]+\"\s+\"(.*)\")",
std::regex::ECMAScript|std::regex::optimize);
hecl::SystemString FindCommonSteamApp(const hecl::SystemChar* name)