Use a standard config dir on non-Windows. Fixes #192
Also remove WindowInfo::GetDefault which was redundant.
This commit is contained in:
+3
-2
@@ -1,4 +1,5 @@
|
||||
#include "stdafx.h"
|
||||
#include "rPlatform.h"
|
||||
#include "Log.h"
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
@@ -98,7 +99,7 @@ struct FileListener : LogListener
|
||||
bool mPrependChannelName;
|
||||
|
||||
FileListener(const std::string& name = _PRGNAME_, bool prependChannel = true)
|
||||
: mFile(name + ".log", rFile::write),
|
||||
: mFile(std::string(rPlatform::getConfigDir() + name + ".log").c_str(), rFile::write),
|
||||
mPrependChannelName(prependChannel)
|
||||
{
|
||||
if (!mFile.IsOpened())
|
||||
@@ -236,4 +237,4 @@ LogManager& LogManager::getInstance()
|
||||
LogChannel &LogManager::getChannel(LogType type)
|
||||
{
|
||||
return mChannels[static_cast<u32>(type)];
|
||||
}
|
||||
}
|
||||
|
||||
+26
-1
@@ -15,6 +15,10 @@
|
||||
#include "Emu/Io/XInput/XInputPadHandler.h"
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <dirent.h>
|
||||
#endif
|
||||
|
||||
|
||||
rCanvas::rCanvas(void *parent)
|
||||
{
|
||||
@@ -135,6 +139,27 @@ int rPlatform::getMouseHandlerCount()
|
||||
return 2;
|
||||
}
|
||||
|
||||
std::string rPlatform::getConfigDir()
|
||||
{
|
||||
static std::string dir = ".";
|
||||
if (dir == ".") {
|
||||
#ifdef _WIN32
|
||||
dir = "";
|
||||
//mkdir(dir.c_str());
|
||||
#else
|
||||
if (getenv("XDG_CONFIG_HOME") != NULL)
|
||||
dir = getenv("XDG_CONFIG_HOME");
|
||||
else if (getenv("HOME") != NULL)
|
||||
dir = getenv("HOME") + std::string("/.config");
|
||||
else // Just in case
|
||||
dir = "./config";
|
||||
dir = dir + "/rpcs3/";
|
||||
mkdir(dir.c_str());
|
||||
#endif
|
||||
}
|
||||
return dir;
|
||||
}
|
||||
|
||||
|
||||
MouseHandlerBase *rPlatform::getMouseHandler(int i)
|
||||
{
|
||||
@@ -179,4 +204,4 @@ PadHandlerBase *rPlatform::getPadHandler(int i)
|
||||
default:
|
||||
return new NullPadHandler();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@ struct rPlatform
|
||||
static MouseHandlerBase *getMouseHandler(int i);
|
||||
static int getPadHandlerCount();
|
||||
static PadHandlerBase *getPadHandler(int i);
|
||||
static std::string getConfigDir();
|
||||
};
|
||||
|
||||
/**********************************************************************
|
||||
|
||||
Reference in New Issue
Block a user