1+ // Copyright 2025 Fred Emmott <fred@fredemmott.com>
2+ // SPDX-License-Identifier: MIT
3+ #include " BackupsFolder.hpp"
4+
5+ #include < Windows.h>
6+ #include < shlobj_core.h>
7+ #include < wil/resource.h>
8+
9+ #include < FredEmmott/GUI.hpp>
10+ #include < memory>
11+
12+ #include " Versions.hpp"
13+
14+ namespace {
15+ std::filesystem::path GetPathForConstructor () {
16+ wil::unique_hlocal_string path;
17+ if (FAILED (SHGetKnownFolderPath (
18+ FOLDERID_LocalAppData, 0 , nullptr , std::out_ptr (path)))) {
19+ return {};
20+ }
21+ const auto ret
22+ = std::filesystem::path {std::wstring_view {path.get ()}} / L" OpenKneeboard Backups" ;
23+ if (!std::filesystem::exists (ret)) {
24+ return {};
25+ }
26+ return ret;
27+ }
28+ }// namespace
29+
30+ BackupsFolder::BackupsFolder ()
31+ : FilesystemArtifact(GetPathForConstructor()) {}
32+
33+ std::string_view BackupsFolder::GetTitle () const {
34+ return " Settings Backups" ;
35+ }
36+
37+ void BackupsFolder::DrawCardContent () const {
38+ namespace fuii = FredEmmott::GUI::Immediate;
39+ fuii::Label (" Found in {}" , GetPath ().string ());
40+ }
41+
42+ Version BackupsFolder::GetEarliestVersion () const {
43+ return Versions::v1_10;
44+ }
45+
46+ std::optional<Version> BackupsFolder::GetRemovedVersion () const {
47+ return std::nullopt ;
48+ }
49+ Artifact::Kind BackupsFolder::GetKind () const {
50+ return Kind::UserSettings;
51+ }
0 commit comments