Skip to content

Commit

Permalink
Color picker logs path (#10375)
Browse files Browse the repository at this point in the history
  • Loading branch information
mykhailopylyp committed Mar 22, 2021
1 parent 77d67f3 commit acbabbe
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/common/interop/interop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,12 @@ public
public:
literal int VK_WIN_BOTH = CommonSharedConstants::VK_WIN_BOTH;

static String ^ AppDataPath() {
auto localPath = Environment::GetFolderPath(Environment::SpecialFolder::LocalApplicationData);
auto powerToysPath = gcnew String(CommonSharedConstants::APPDATA_PATH);
return System::IO::Path::Combine(localPath, powerToysPath);
}

static String ^ PowerLauncherSharedEvent() {
return gcnew String(CommonSharedConstants::POWER_LAUNCHER_SHARED_EVENT);
}
Expand Down
2 changes: 2 additions & 0 deletions src/common/interop/shared_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ namespace CommonSharedConstants
// Fake key code to represent VK_WIN.
inline const int VK_WIN_BOTH = 0x104;

const wchar_t APPDATA_PATH[] = L"Microsoft\\PowerToys";

// Path to the event used by PowerLauncher
const wchar_t POWER_LAUNCHER_SHARED_EVENT[] = L"Local\\PowerToysRunInvokeEvent-30f26ad7-d36d-4c0e-ab02-68bb5ff3c4ab";

Expand Down
4 changes: 3 additions & 1 deletion src/modules/colorPicker/ColorPickerUI/Helpers/Logger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@
using System;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.IO.Abstractions;
using interop;

namespace ColorPicker.Helpers
{
public static class Logger
{
private static readonly IFileSystem _fileSystem = new FileSystem();
private static readonly string ApplicationLogPath = _fileSystem.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "ColorPicker");
private static readonly string ApplicationLogPath = Path.Combine(Constants.AppDataPath(), "ColorPicker\\Logs");

static Logger()
{
Expand Down

0 comments on commit acbabbe

Please sign in to comment.