Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cmake/Modules/FindFMOD.cmake
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is this?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Include of header files provided by fmod package from AUR. Can be removed.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks good and I like the idea, I'm probably not qualified to review and unable to run it myself though..

Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ FIND_PATH(FMOD_INCLUDE_DIR
/opt/local/include/fmodstudio/
/opt/include/
/opt/include/fmodstudio/
/opt/fmodengine/api/core/inc/
)

FIND_LIBRARY(FMOD_LIBRARY
Expand All @@ -42,6 +43,7 @@ FIND_LIBRARY(FMOD_LIBRARY
/opt/lib64
/opt/lib
/usr/freeware/lib64
/usr/lib/fmodengine
)

if (FMOD_LIBRARY)
Expand Down
22 changes: 18 additions & 4 deletions src/editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
#include "init.hpp"
#include "mod_tools.hpp"
#include <sys/stat.h>
#ifdef LINUX
#include <filesystem>
#endif
#ifndef EDITOR
#define EDITOR
#endif
Expand Down Expand Up @@ -1579,10 +1582,21 @@ int main(int argc, char** argv)
#ifdef WINDOWS
strcpy(outputdir, "./");
#else
char *basepath = getenv("HOME");
snprintf(outputdir, sizeof(outputdir), "%s/.barony", basepath);
if ( access(outputdir, F_OK) == -1 )
mkdir(outputdir, 0777);
std::string basepath;
if (strlen(getenv("XDG_DATA_HOME")) > 0)
{
printlog("Picked up XDG_DATA_HOME: %s", getenv("XDG_DATA_HOME"));
basepath = getenv("XDG_DATA_HOME");
basepath += "/barony";
}
else
{
printlog("XDG_DATA_HOME does not exit, using HOME");
basepath = getenv("HOME");
basepath += "/.local/share/barony";
}
snprintf(outputdir, sizeof(outputdir), "%s", basepath.c_str());
std::filesystem::create_directories(outputdir);
#endif

// load default language file (english)
Expand Down
32 changes: 18 additions & 14 deletions src/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
#include <string.h>
#include <execinfo.h>
#include <sys/stat.h>
#include <filesystem>

static SDL_bool SDL_MouseModeBeforeSignal = SDL_FALSE;
static int SDL_MouseShowBeforeSignal = SDL_ENABLE;
Expand Down Expand Up @@ -6755,29 +6756,32 @@ int main(int argc, char** argv)
strcpy(outputdir, "./");
#else
#ifndef NINTENDO
char *basepath = getenv("HOME");
std::string basepath;
if (strlen(getenv("XDG_DATA_HOME")) > 0)
{
printlog("Picked up $XDG_DATA_HOME: %s", getenv("XDG_DATA_HOME"));
basepath = getenv("XDG_DATA_HOME");
basepath += "/barony";
}
else
{
printlog("XDG_DATA_HOME does not exit, using ~/.local/share/barony");
basepath = getenv("HOME");
basepath += "/.local/share/barony";
}
#ifdef USE_EOS
#ifdef STEAMWORKS
//Steam + EOS
snprintf(outputdir, sizeof(outputdir), "%s/.barony", basepath);
snprintf(outputdir, sizeof(outputdir), "%s", basepath.c_str());
#else
//Just EOS.
std::string firstDotdir(basepath);
firstDotdir += "/.barony/";
if (access(firstDotdir.c_str(), F_OK) == -1)
{
mkdir(firstDotdir.c_str(), 0777); //Since this mkdir is not equivalent to mkdir -p, have to create each part of the path manually.
}
snprintf(outputdir, sizeof(outputdir), "%s/epicgames", firstDotdir.c_str());
snprintf(outputdir, sizeof(outputdir), "%s/epicgames", basepath.c_str());
#endif
#else //USE_EOS
//No EOS. Could be Steam though. Or could also not.
snprintf(outputdir, sizeof(outputdir), "%s/.barony", basepath);
snprintf(outputdir, sizeof(outputdir), "%s", basepath.c_str());
#endif
if (access(outputdir, F_OK) == -1)
{
mkdir(outputdir, 0777);
}
std::filesystem::create_directories(outputdir); // mkdir -p from C++ 17 https://en.cppreference.com/w/cpp/filesystem/create_directory.html
#else // !NINTENDO
strcpy(outputdir, "save:");
#endif // NINTENDO
Expand Down