mirror of
https://github.com/gnif/LookingGlass.git
synced 2026-08-22 07:01:30 +00:00
[idd] helper: open the IDD log directory
The interactive Helper now writes its own log under LocalAppData so it can run with the desktop user token. The tray menu should still take users to the system-wide IDD and service logs under ProgramData. Expose the log-directory resolver and have Open log directory request the ProgramData location explicitly. Keep Helper log storage unchanged.
This commit is contained in:
@@ -101,7 +101,7 @@ inline static void iso8601(wchar_t *buf, size_t count)
|
|||||||
wcsftime(buf, count, L"%Y-%m-%d %H:%M:%SZ", &utc);
|
wcsftime(buf, count, L"%Y-%m-%d %H:%M:%SZ", &utc);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static std::wstring getLogPath(CDebug::Location location)
|
std::wstring CDebug::GetLogDir(Location location)
|
||||||
{
|
{
|
||||||
PWSTR pszPath;
|
PWSTR pszPath;
|
||||||
const KNOWNFOLDERID& folder = location == CDebug::Location::LocalAppData ?
|
const KNOWNFOLDERID& folder = location == CDebug::Location::LocalAppData ?
|
||||||
@@ -133,7 +133,7 @@ inline static std::wstring getLogPath(CDebug::Location location)
|
|||||||
|
|
||||||
void CDebug::Init(const wchar_t * name, Location location)
|
void CDebug::Init(const wchar_t * name, Location location)
|
||||||
{
|
{
|
||||||
m_logDir = getLogPath(location);
|
m_logDir = GetLogDir(location);
|
||||||
|
|
||||||
// don't redirect the debug output if running under a debugger
|
// don't redirect the debug output if running under a debugger
|
||||||
if (IsDebuggerPresent())
|
if (IsDebuggerPresent())
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
class CDebug
|
class CDebug
|
||||||
{
|
{
|
||||||
@@ -51,7 +52,8 @@ class CDebug
|
|||||||
LEVEL_MAX
|
LEVEL_MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
const wchar_t *logDir() { return m_logDir.c_str(); }
|
const wchar_t *logDir() const { return m_logDir.c_str(); }
|
||||||
|
static std::wstring GetLogDir(Location location);
|
||||||
void Init(const wchar_t * name,
|
void Init(const wchar_t * name,
|
||||||
Location location = Location::ProgramData);
|
Location location = Location::ProgramData);
|
||||||
void Log_va(CDebug::Level level, const char *function, int line, const wchar_t *fmt, va_list args);
|
void Log_va(CDebug::Level level, const char *function, int line, const wchar_t *fmt, va_list args);
|
||||||
|
|||||||
@@ -196,8 +196,13 @@ LRESULT CNotifyWindow::onNotifyIcon(UINT uEvent, WORD wIconId, int x, int y)
|
|||||||
switch (TrackPopupMenu(m_menu, TPM_RETURNCMD | TPM_NONOTIFY, x, y, 0, m_hwnd, NULL))
|
switch (TrackPopupMenu(m_menu, TPM_RETURNCMD | TPM_NONOTIFY, x, y, 0, m_hwnd, NULL))
|
||||||
{
|
{
|
||||||
case ID_MENU_SHOW_LOG:
|
case ID_MENU_SHOW_LOG:
|
||||||
ShellExecute(m_hwnd, L"open", g_debug.logDir(), NULL, NULL, SW_NORMAL);
|
{
|
||||||
|
const std::wstring logDir =
|
||||||
|
CDebug::GetLogDir(CDebug::Location::ProgramData);
|
||||||
|
if (!logDir.empty())
|
||||||
|
ShellExecute(m_hwnd, L"open", logDir.c_str(), NULL, NULL, SW_NORMAL);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case ID_MENU_SHOW_CONFIG:
|
case ID_MENU_SHOW_CONFIG:
|
||||||
DEBUG_INFO("Config window opened");
|
DEBUG_INFO("Config window opened");
|
||||||
m_config.reset(new CConfigWindow());
|
m_config.reset(new CConfigWindow());
|
||||||
|
|||||||
Reference in New Issue
Block a user