1
0
mirror of https://github.com/narzoul/DDrawCompat synced 2024-12-30 08:55:36 +01:00

Create log file in process dir instead of current working dir

This commit is contained in:
narzoul 2021-02-21 12:40:47 +01:00
parent b4ef2a1c0c
commit 97e08f7988
3 changed files with 4 additions and 4 deletions

View File

@ -76,7 +76,7 @@ namespace Compat
s_logFile << std::endl;
}
void Log::initLogging(std::string processName)
void Log::initLogging(const std::string& processDir, std::string processName)
{
if (processName.length() >= 4 &&
0 == _strcmpi(processName.substr(processName.length() - 4).c_str(), ".exe"))
@ -87,7 +87,7 @@ namespace Compat
for (int i = 1; i < 100; ++i)
{
std::ostringstream logFileName;
logFileName << "DDrawCompat-" << processName;
logFileName << processDir << '\\' << "DDrawCompat-" << processName;
if (i > 1)
{
logFileName << '[' << i << ']';

View File

@ -166,7 +166,7 @@ namespace Compat
return *this;
}
static void initLogging(std::string processName);
static void initLogging(const std::string& processDir, std::string processName);
static bool isPointerDereferencingAllowed() { return s_isLeaveLog || 0 == s_outParamDepth; }
protected:

View File

@ -230,7 +230,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
}
auto processPath = getModulePath(nullptr);
Compat::Log::initLogging(getFileName(processPath));
Compat::Log::initLogging(getDirName(processPath), getFileName(processPath));
Compat::Log() << "Process path: " << processPath;
printEnvironmentVariable("__COMPAT_LAYER");