mirror of
https://github.com/gnif/LookingGlass.git
synced 2026-08-22 15:11:31 +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);
|
||||
}
|
||||
|
||||
inline static std::wstring getLogPath(CDebug::Location location)
|
||||
std::wstring CDebug::GetLogDir(Location location)
|
||||
{
|
||||
PWSTR pszPath;
|
||||
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)
|
||||
{
|
||||
m_logDir = getLogPath(location);
|
||||
m_logDir = GetLogDir(location);
|
||||
|
||||
// don't redirect the debug output if running under a debugger
|
||||
if (IsDebuggerPresent())
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
#include <Windows.h>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
|
||||
class CDebug
|
||||
{
|
||||
@@ -51,7 +52,8 @@ class CDebug
|
||||
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,
|
||||
Location location = Location::ProgramData);
|
||||
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))
|
||||
{
|
||||
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;
|
||||
}
|
||||
case ID_MENU_SHOW_CONFIG:
|
||||
DEBUG_INFO("Config window opened");
|
||||
m_config.reset(new CConfigWindow());
|
||||
|
||||
Reference in New Issue
Block a user