MCPcopy Create free account
hub / github.com/TranslucentTB/TranslucentTB / file

Method file

TranslucentTB/windows/window.cpp:129–155  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

127}
128
129std::optional<std::filesystem::path> Window::file() const
130{
131 const auto pid = process_id();
132
133 if (auto imageName = TryGetNtImageName(pid))
134 {
135 return { std::move(*imageName) };
136 }
137 else
138 {
139 const wil::unique_process_handle processHandle(OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, false, pid));
140 if (!processHandle)
141 {
142 LastErrorHandle(spdlog::level::info, L"Getting process handle of a window failed.");
143 return std::nullopt;
144 }
145
146 auto [loc, hr] = win32::GetProcessFileName(processHandle.get());
147 if (FAILED(hr))
148 {
149 HresultHandle(hr, spdlog::level::info, L"Getting file name of a window failed.");
150 return std::nullopt;
151 }
152
153 return { std::move(loc) };
154 }
155}
156
157std::optional<bool> Window::on_current_desktop() const
158{

Callers 5

IsFilteredMethod · 0.80
FindRuleInnerMethod · 0.80
OpenLogFileRequestedMethod · 0.80
DumpWindowMethod · 0.80
ResetStateMethod · 0.80

Calls 1

getMethod · 0.80

Tested by

no test coverage detected