Debian Codegraph @

src/core/profilestorage.cpp

raw symbols SCIP
1 // SPDX-License-Identifier: GPL-3.0-or-latercxx . . $ `<file>/src/core/profilestorage.cpp`/
2 // Copyright 2019 Juan Palacios <[email protected]>
3
4 #include "profilestorage.h"cxx . . $ `<file>/src/core/profilestorage.h`/
5
6 #include "common/fileutils.h"cxx . . $ `<file>/src/common/fileutils.h`/
7 #include "iprofilefileparser.h"cxx . . $ `<file>/src/core/iprofilefileparser.h`/
8 #include "iprofileiconcache.h"cxx . . $ `<file>/src/core/iprofileiconcache.h`/
9 #include "iprofileparser.h"cxx . . $ `<file>/src/core/iprofileparser.h`/
10 #include <exception>
11 #include <format>
12 #include <spdlog/spdlog.h>
13 #include <stdexcept>
14 #include <utility>
15
16 namespace fs = stdcxx . . $ std/::filesystem;
17
18 ProfileStoragecxx . . $ ProfileStorage#::ProfileStoragecxx . . $ ProfileStorage#ProfileStorage(1b3e9892d7830096).(
19 stdcxx . . $ std/::filesystemcxx . . $ std/filesystem/::pathcxx . . $ std/filesystem/__cxx11/path# &&path,
20 stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<IProfileParsercxx . . $ IProfileParser#> &&profileParser,
21 stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<IProfileFileParsercxx . . $ IProfileFileParser#> &&profileFileParser,
22 stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<IProfileIconCachecxx . . $ IProfileIconCache#> &&iconCache) noexcept
23 : path_cxx . . $ ProfileStorage#path_.(stdcxx . . $ std/::movecxx . . $ std/move(e35c19a1ba7baa26).(path))
24 , profileParser_cxx . . $ ProfileStorage#profileParser_.(stdcxx . . $ std/::movecxx . . $ std/move(e35c19a1ba7baa26).(profileParser))
25 , profileFileParser_cxx . . $ ProfileStorage#profileFileParser_.(stdcxx . . $ std/::movecxx . . $ std/move(e35c19a1ba7baa26).(profileFileParser))
26 , iconCache_cxx . . $ ProfileStorage#iconCache_.(stdcxx . . $ std/::movecxx . . $ std/move(e35c19a1ba7baa26).(iconCache))
27 , profileDataFileName_cxx . . $ ProfileStorage#profileDataFileName_.(IProfileFileParsercxx . . $ IProfileFileParser#::ProfileDataFileNamecxx . . $ IProfileFileParser#ProfileDataFileName.)
28 {
29 fileExtension_cxx . . $ ProfileStorage#fileExtension_. +=cxx . . $ std/__cxx11/basic_string#`operator+=`(c0b47be1fddc0e75). "." +cxx . . $ std/operator+(39ed2c165380f78e). profileFileParser_cxx . . $ ProfileStorage#profileFileParser_.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).fileExtensioncxx . . $ IProfileFileParser#fileExtension(219584694fe2b248).();
30 profileDataFileName_cxx . . $ ProfileStorage#profileDataFileName_. +=cxx . . $ std/__cxx11/basic_string#`operator+=`(c0b47be1fddc0e75). "." +cxx . . $ std/operator+(42c652dfebe55ad7). profileParser_cxx . . $ ProfileStorage#profileParser_.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).formatcxx . . $ IProfileParser#format(319d84e01067f75d).();
31 }
32
33 void ProfileStoragecxx . . $ ProfileStorage#::initcxx . . $ ProfileStorage#init(6c259bdacab5687).(IProfilecxx . . $ IProfile# const &defaultProfile)
34 {
35 initProfilesDirectorycxx . . $ ProfileStorage#initProfilesDirectory(83f5f38750778ac8).();
36
37 // initialize components
38 defaultProfile.exportWithcxx . . $ Exportable#exportWith(5b5c94ff60635419).(*cxx . . $ std/unique_ptr#`operator*`(2fbe4a4c783c152d).profileParser_cxx . . $ ProfileStorage#profileParser_.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).initializercxx . . $ IProfileParser#initializer(6b4e1016740e578).());
39 iconCache_cxx . . $ ProfileStorage#iconCache_.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).initcxx . . $ IProfileIconCache#init(49f6e7a06ebc5aa8).();
40 }
41
42 stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<IProfilecxx . . $ IProfile#>>
43 ProfileStoragecxx . . $ ProfileStorage#::profilescxx . . $ ProfileStorage#profiles(61ed034afd0cae0).(IProfilecxx . . $ IProfile# const &baseProfile)
44 {
45 stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<IProfilecxx . . $ IProfile#>> profilescxx . . $ std/vector#vector(49f6e7a06ebc5aa8).;
46
47 if (profilesDirectoryExistcxx . . $ ProfileStorage#profilesDirectoryExist(50ce9a9e25b4a850).()) {
48 for (auto const &pathIt : fscxx . . $ std/filesystem/__cxx11/directory_iterator#directory_iterator(3f42e2c2fac0d5fc).::directory_iteratorcxx . . $ std/filesystem/__cxx11/directory_iterator#(path_cxx . . $ ProfileStorage#path_.)) {
49
50 auto const &filePath = pathIt.pathcxx . . $ std/filesystem/__cxx11/directory_entry#path(3df3a2cdf6f4d926).();
51 if (Utilscxx . . $ Utils/::Filecxx . . $ Utils/File/::isFilePathValidcxx . . $ Utils/File/isFilePathValid(c53a6ef3278968b1).(filePath) &&
52 filePath.extensioncxx . . $ std/filesystem/__cxx11/path#extension(159787a050b29eb0).() ==cxx . . $ std/filesystem/__cxx11/`operator==`(33cf7b584ac59a9b). fileExtension_cxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d).) {
53
54 auto profile = baseProfile.clonecxx . . $ IProfile#clone(f422f8feab2476b6).();
55 if (loadProfileFromStoragecxx . . $ ProfileStorage#loadProfileFromStorage(156655c70f793ec).(filePath, *cxx . . $ std/unique_ptr#`operator*`(2fbe4a4c783c152d).profile))
56 profiles.emplace_backcxx . . $ std/vector#emplace_back(a1bcdfdabc3a37df).(stdcxx . . $ std/::movecxx . . $ std/move(e35c19a1ba7baa26).(profile));
57 }
58 }
59 }
60
61 return profilescxx . . $ std/vector#vector(6f559d22b039ccdb).;
62 }
63
64 bool ProfileStoragecxx . . $ ProfileStorage#::loadcxx . . $ ProfileStorage#load(65662de94ba945c4).(IProfilecxx . . $ IProfile# &profile)
65 {
66 if (profilesDirectoryExistcxx . . $ ProfileStorage#profilesDirectoryExist(50ce9a9e25b4a850).()) {
67 auto info = profile.infocxx . . $ IProfile#info(ad075d653bfbbbea).();
68 auto fileName = info.execxx . . $ IProfile#Info#exe. != IProfilecxx . . $ std/basic_string_view#basic_string_view(b419d9def655ef02).::Infocxx . . $ IProfile#Info#::ManualIDcxx . . $ IProfile#Info#ManualID.
69 ? info.execxx . . $ IProfile#Info#exe. +cxx . . $ std/operator+(2764d1739bf7913d). fileExtension_cxx . . $ ProfileStorage#fileExtension_.
70 : info.execxx . . $ IProfile#Info#exe. +cxx . . $ std/operator+(2764d1739bf7913d). info.namecxx . . $ IProfile#Info#name. +cxx . . $ std/operator+(db5dc2ea912c6495). fileExtension_cxx . . $ ProfileStorage#fileExtension_.;
71 return loadProfileFromStoragecxx . . $ ProfileStorage#loadProfileFromStorage(156655c70f793ec).(path_cxx . . $ ProfileStorage#path_. /cxx . . $ std/filesystem/__cxx11/`operator/`(578e0438ad5f0e7e). fileNamecxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d)., profile);
72 }
73
74 return false;
75 }
76
77 bool ProfileStoragecxx . . $ ProfileStorage#::savecxx . . $ ProfileStorage#save(65662de94ba945c4).(IProfilecxx . . $ IProfile# &profile)
78 {
79 if (profilesDirectoryExistcxx . . $ ProfileStorage#profilesDirectoryExist(50ce9a9e25b4a850).()) {
80
81 auto info = profile.infocxx . . $ IProfile#info(ad075d653bfbbbea).();
82 auto fileName = info.execxx . . $ IProfile#Info#exe. != IProfilecxx . . $ std/basic_string_view#basic_string_view(b419d9def655ef02).::Infocxx . . $ IProfile#Info#::ManualIDcxx . . $ IProfile#Info#ManualID.
83 ? info.execxx . . $ IProfile#Info#exe. +cxx . . $ std/operator+(2764d1739bf7913d). fileExtension_cxx . . $ ProfileStorage#fileExtension_.
84 : info.execxx . . $ IProfile#Info#exe. +cxx . . $ std/operator+(2764d1739bf7913d). info.namecxx . . $ IProfile#Info#name. +cxx . . $ std/operator+(db5dc2ea912c6495). fileExtension_cxx . . $ ProfileStorage#fileExtension_.;
85 auto exported = exportTocxx . . $ ProfileStorage#exportTo(58603e3286cb501).(profile, path_cxx . . $ ProfileStorage#path_. /cxx . . $ std/filesystem/__cxx11/`operator/`(578e0438ad5f0e7e). fileNamecxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d).);
86 if (exported) {
87
88 if (info.hasCustomIconcxx . . $ IProfile#Info#hasCustomIcon(50ce9a9e25b4a850).()) {
89
90 // sync icon cache when custom icons are used
91 auto [success, updated] = iconCache_cxx . . $ ProfileStorage#iconCache_.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).syncCachecxx . . $ IProfileIconCache#syncCache(2154c7156f3f0c8c).(info);
92 if (success && updated)
93 profile.infocxx . . $ IProfile#info(7a3f345cc6258353).(info);
94 }
95
96 return true;
97 }
98 }
99
100 return false;
101 }
102
103 bool ProfileStoragecxx . . $ ProfileStorage#::loadFromcxx . . $ ProfileStorage#loadFrom(e6dc3a67757fd1b5).(IProfilecxx . . $ IProfile# &profile,
104 stdcxx . . $ std/::filesystemcxx . . $ std/filesystem/::pathcxx . . $ std/filesystem/__cxx11/path# const &path) const
105 {
106 if (Utilscxx . . $ Utils/::Filecxx . . $ Utils/File/::isFilePathValidcxx . . $ Utils/File/isFilePathValid(c53a6ef3278968b1).(path) && path.extensioncxx . . $ std/filesystem/__cxx11/path#extension(159787a050b29eb0).() ==cxx . . $ std/filesystem/__cxx11/`operator==`(33cf7b584ac59a9b). fileExtension_cxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d).)
107 return loadProfileFromcxx . . $ ProfileStorage#loadProfileFrom(156655c70f793ec).(path, profile);
108 else
109 SPDLOG_DEBUGcxx . . $ `<external>/13613935168682455490/spdlog.h:311:13`!("Cannot load {}. Invalid file.", path.c_str());
110
111 return false;
112 }
113
114 bool ProfileStoragecxx . . $ ProfileStorage#::exportTocxx . . $ ProfileStorage#exportTo(58603e3286cb501).(IProfilecxx . . $ IProfile# const &profile,
115 stdcxx . . $ std/::filesystemcxx . . $ std/filesystem/::pathcxx . . $ std/filesystem/__cxx11/path# const &path) const
116 {
117 stdcxx . . $ std/::vectorcxx . . $ std/vector#<char> profileDatacxx . . $ std/vector#vector(49f6e7a06ebc5aa8).;
118 if (profileParser_cxx . . $ ProfileStorage#profileParser_.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).savecxx . . $ IProfileParser#save(751860f9352cffff).(profileData, profile)) {
119
120 stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::paircxx . . $ std/pair#<stdcxx . . $ std/::stringcxx . . $ std/string#, stdcxx . . $ std/::vectorcxx . . $ std/vector#<char>>> datacxx . . $ std/vector#vector(49f6e7a06ebc5aa8).;
121 data.emplace_backcxx . . $ std/vector#emplace_back(a1bcdfdabc3a37df).(stdcxx . . $ std/::stringcxx . . $ std/string#(profileDataFileName_cxx . . $ ProfileStorage#profileDataFileName_.), stdcxx . . $ std/::movecxx . . $ std/move(e35c19a1ba7baa26).(profileData));
122
123 auto info = profile.infocxx . . $ IProfile#info(ad075d653bfbbbea).();
124 if (info.hasCustomIconcxx . . $ IProfile#Info#hasCustomIcon(50ce9a9e25b4a850).()) {
125
126 // save the custom icon in the profile
127 auto iconData = Utilscxx . . $ Utils/::Filecxx . . $ Utils/File/::readFilecxx . . $ Utils/File/readFile(ca87ac95f82c0a15).(infocxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d)..iconURLcxx . . $ IProfile#Info#iconURL.);
128 if (!iconData.emptycxx . . $ std/vector#empty(3482b152b9333168).())
129 data.emplace_backcxx . . $ std/vector#emplace_back(a1bcdfdabc3a37df).(stdcxx . . $ std/::stringcxx . . $ std/string#(IProfileFileParsercxx . . $ IProfileFileParser#::IconDataFileNamecxx . . $ IProfileFileParser#IconDataFileName.),
130 stdcxx . . $ std/::movecxx . . $ std/move(e35c19a1ba7baa26).(iconData));
131 }
132
133 auto targetFilePath = pathcxx . . $ std/filesystem/__cxx11/path#path(3f42e2c2fac0d5fc).;
134 if (targetFilePath.extensioncxx . . $ std/filesystem/__cxx11/path#extension(159787a050b29eb0).() != fileExtension_cxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d).)
135 targetFilePath +=cxx . . $ std/filesystem/__cxx11/path#`operator+=`(b0f876b6561701af). fileExtension_cxx . . $ ProfileStorage#fileExtension_.;
136
137 return profileFileParser_cxx . . $ ProfileStorage#profileFileParser_.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).savecxx . . $ IProfileFileParser#save(fa1fcfc7541085fc).(targetFilePath, data);
138 }
139
140 return false;
141 }
142
143 bool ProfileStoragecxx . . $ ProfileStorage#::updatecxx . . $ ProfileStorage#update(55d4602e6608d94e).(IProfilecxx . . $ IProfile# const &profile, IProfilecxx . . $ IProfile#::Infocxx . . $ IProfile#Info# &newInfo)
144 {
145 auto updatedProfile = profile.clonecxx . . $ IProfile#clone(f422f8feab2476b6).();
146 if (!loadcxx . . $ ProfileStorage#load(65662de94ba945c4).(*cxx . . $ std/unique_ptr#`operator*`(2fbe4a4c783c152d).updatedProfile))
147 return false;
148
149 // manual profiles are always active
150 if (newInfo.execxx . . $ IProfile#Info#exe. == IProfilecxx . . $ std/basic_string_view#basic_string_view(b419d9def655ef02).::Infocxx . . $ IProfile#Info#::ManualIDcxx . . $ IProfile#Info#ManualID. && !updatedProfile->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).activecxx . . $ IProfile#active(50ce9a9e25b4a850).())
151 updatedProfile->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).activatecxx . . $ IProfile#activate(b45ddcbc8423892c).(true);
152
153 auto oldInfo = profile.infocxx . . $ IProfile#info(ad075d653bfbbbea).();
154 updatedProfile->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).infocxx . . $ IProfile#info(7a3f345cc6258353).(newInfo);
155 if (!savecxx . . $ ProfileStorage#save(65662de94ba945c4).(*cxx . . $ std/unique_ptr#`operator*`(2fbe4a4c783c152d).updatedProfile))
156 return false;
157
158 auto cacheURL = updatedProfilecxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5).->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).infocxx . . $ IProfile#info(ad075d653bfbbbea).().iconURLcxx . . $ IProfile#Info#iconURL.;
159 if (cacheURL != newInfo.iconURLcxx . . $ IProfile#Info#iconURL.)
160 newInfo.iconURLcxx . . $ IProfile#Info#iconURL. =cxx . . $ std/__cxx11/basic_string#`operator=`(c0b47be1fddc0e75). cacheURL;
161
162 if (oldInfo.execxx . . $ IProfile#Info#exe. != newInfo.execxx . . $ IProfile#Info#exe. ||
163 (oldInfo.execxx . . $ IProfile#Info#exe. == IProfilecxx . . $ std/basic_string_view#basic_string_view(b419d9def655ef02).::Infocxx . . $ IProfile#Info#::ManualIDcxx . . $ IProfile#Info#ManualID. &&
164 newInfo.execxx . . $ IProfile#Info#exe. == IProfilecxx . . $ std/basic_string_view#basic_string_view(b419d9def655ef02).::Infocxx . . $ IProfile#Info#::ManualIDcxx . . $ IProfile#Info#ManualID. && oldInfo.namecxx . . $ IProfile#Info#name. != newInfo.namecxx . . $ IProfile#Info#name.))
165 removecxx . . $ ProfileStorage#remove(874cae2a8ac0280d).(oldInfo);
166
167 return true;
168 }
169
170 void ProfileStoragecxx . . $ ProfileStorage#::removecxx . . $ ProfileStorage#remove(874cae2a8ac0280d).(IProfilecxx . . $ IProfile#::Infocxx . . $ IProfile#Info# &info)
171 {
172 if (profilesDirectoryExistcxx . . $ ProfileStorage#profilesDirectoryExist(50ce9a9e25b4a850).()) {
173 iconCache_cxx . . $ ProfileStorage#iconCache_.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).cleancxx . . $ IProfileIconCache#clean(874cae2a8ac0280d).(info);
174
175 auto fileName = info.execxx . . $ IProfile#Info#exe. != IProfilecxx . . $ std/basic_string_view#basic_string_view(b419d9def655ef02).::Infocxx . . $ IProfile#Info#::ManualIDcxx . . $ IProfile#Info#ManualID.
176 ? info.execxx . . $ IProfile#Info#exe. +cxx . . $ std/operator+(2764d1739bf7913d). fileExtension_cxx . . $ ProfileStorage#fileExtension_.
177 : info.execxx . . $ IProfile#Info#exe. +cxx . . $ std/operator+(2764d1739bf7913d). info.namecxx . . $ IProfile#Info#name. +cxx . . $ std/operator+(db5dc2ea912c6495). fileExtension_cxx . . $ ProfileStorage#fileExtension_.;
178 try {
179 fs::removecxx . . $ std/filesystem/remove(c53a6ef3278968b1).(path_cxx . . $ ProfileStorage#path_. /cxx . . $ std/filesystem/__cxx11/`operator/`(578e0438ad5f0e7e). fileNamecxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d).);
180 }
181 catch (stdcxx . . $ std/::exception const &e) {
182 SPDLOG_DEBUGcxx . . $ `<external>/13613935168682455490/spdlog.h:311:13`!(e.what());
183 }
184 }
185 }
186
187 void ProfileStoragecxx . . $ ProfileStorage#::initProfilesDirectorycxx . . $ ProfileStorage#initProfilesDirectory(83f5f38750778ac8).() const
188 {
189 if (!fs::existscxx . . $ std/filesystem/exists(c53a6ef3278968b1).(path_cxx . . $ ProfileStorage#path_.)) {
190 fs::create_directoriescxx . . $ std/filesystem/create_directories(c53a6ef3278968b1).(path_cxx . . $ ProfileStorage#path_.);
191 fs::permissionscxx . . $ std/filesystem/permissions(b42180d75ff20d25).(path_cxx . . $ ProfileStorage#path_., fs::permscxx . . $ std/filesystem/perms#::owner_allcxx . . $ std/filesystem/perms#owner_all. |cxx . . $ std/filesystem/`operator|`(a75dd80e7ac4ad25). fs::permscxx . . $ std/filesystem/perms#::group_readcxx . . $ std/filesystem/perms#group_read. |cxx . . $ std/filesystem/`operator|`(a75dd80e7ac4ad25).
192 fs::permscxx . . $ std/filesystem/perms#::group_execcxx . . $ std/filesystem/perms#group_exec. |cxx . . $ std/filesystem/`operator|`(a75dd80e7ac4ad25). fs::permscxx . . $ std/filesystem/perms#::others_readcxx . . $ std/filesystem/perms#others_read. |cxx . . $ std/filesystem/`operator|`(a75dd80e7ac4ad25).
193 fs::permscxx . . $ std/filesystem/perms#::others_execcxx . . $ std/filesystem/perms#others_exec.);
194 }
195
196 if (!fs::is_directorycxx . . $ std/filesystem/is_directory(c53a6ef3278968b1).(path_cxx . . $ ProfileStorage#path_.))
197 throw stdcxx . . $ std/::runtime_errorcxx . . $ std/runtime_error#(
198 stdcxx . . $ std/::formatcxx . . $ std/format(7a9e6f4918cdc192).("{} is not a directory."cxx . . $ std/basic_format_string#basic_format_string(edcd8b2679e9bd1a)., path_cxx . . $ ProfileStorage#path_..c_strcxx . . $ std/filesystem/__cxx11/path#c_str(ba32b354807b2b81).()));
199 }
200
201 bool ProfileStoragecxx . . $ ProfileStorage#::profilesDirectoryExistcxx . . $ ProfileStorage#profilesDirectoryExist(50ce9a9e25b4a850).() const
202 {
203 if (Utilscxx . . $ Utils/::Filecxx . . $ Utils/File/::isDirectoryPathValidcxx . . $ Utils/File/isDirectoryPathValid(c53a6ef3278968b1).(path_cxx . . $ ProfileStorage#path_.))
204 return true;
205
206 SPDLOG_DEBUGcxx . . $ `<external>/13613935168682455490/spdlog.h:311:13`!("Something went wrong with the profile storage directory: ",
207 path_.c_str());
208
209 return false;
210 }
211
212 bool ProfileStoragecxx . . $ ProfileStorage#::loadProfileFromStoragecxx . . $ ProfileStorage#loadProfileFromStorage(156655c70f793ec).(stdcxx . . $ std/::filesystemcxx . . $ std/filesystem/::pathcxx . . $ std/filesystem/__cxx11/path# const &path,
213 IProfilecxx . . $ IProfile# &profile) const
214 {
215 auto profileData = profileFileParser_cxx . . $ ProfileStorage#profileFileParser_.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).loadcxx . . $ IProfileFileParser#load(4a2d2be9eefdc507).(path, profileDataFileName_cxx . . $ ProfileStorage#profileDataFileName_.);
216 if (profileData.has_valuecxx . . $ std/optional#has_value(3482b152b9333168).()) {
217 if (profileParser_cxx . . $ ProfileStorage#profileParser_.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).loadcxx . . $ IProfileParser#load(3950ab7b6b62e024).(*cxx . . $ std/optional#`operator*`(47e1a15210ec6306).profileData, profile)) {
218
219 auto info = profile.infocxx . . $ IProfile#info(ad075d653bfbbbea).();
220 if (info.execxx . . $ IProfile#Info#exe. == IProfilecxx . . $ std/basic_string_view#basic_string_view(b419d9def655ef02).::Infocxx . . $ IProfile#Info#::GlobalIDcxx . . $ IProfile#Info#GlobalID.)
221 info.iconURLcxx . . $ IProfile#Info#iconURL. =cxx . . $ std/__cxx11/basic_string#`operator=`(d07e3dd77f70328a). IProfilecxx . . $ IProfile#::Infocxx . . $ IProfile#Info#::GlobalIconURLcxx . . $ IProfile#Info#GlobalIconURL.;
222 else {
223 // try to read the icon stored in the profile
224 auto profileIcon = profileFileParser_cxx . . $ ProfileStorage#profileFileParser_.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).loadcxx . . $ IProfileFileParser#load(4a2d2be9eefdc507).(
225 path, stdcxx . . $ std/::stringcxx . . $ std/string#(IProfileFileParsercxx . . $ IProfileFileParser#::IconDataFileNamecxx . . $ IProfileFileParser#IconDataFileName.));
226
227 // profiles without icons use the default icon
228 if (!profileIcon.has_valuecxx . . $ std/optional#has_value(3482b152b9333168).())
229 info.iconURLcxx . . $ IProfile#Info#iconURL. =cxx . . $ std/__cxx11/basic_string#`operator=`(d07e3dd77f70328a). IProfilecxx . . $ IProfile#::Infocxx . . $ IProfile#Info#::DefaultIconURLcxx . . $ IProfile#Info#DefaultIconURL.;
230
231 // profiles with icons use a cached icon
232 else if (iconCache_cxx . . $ ProfileStorage#iconCache_.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).tryOrCachecxx . . $ IProfileIconCache#tryOrCache(55a8732119d590fe).(info, *cxx . . $ std/optional#`operator*`(47e1a15210ec6306).profileIcon))
233 profile.infocxx . . $ IProfile#info(7a3f345cc6258353).(info);
234 }
235
236 return true;
237 }
238 }
239
240 return false;
241 }
242
243 bool ProfileStoragecxx . . $ ProfileStorage#::loadProfileFromcxx . . $ ProfileStorage#loadProfileFrom(156655c70f793ec).(stdcxx . . $ std/::filesystemcxx . . $ std/filesystem/::pathcxx . . $ std/filesystem/__cxx11/path# const &path,
244 IProfilecxx . . $ IProfile# &profile) const
245 {
246 auto profileData = profileFileParser_cxx . . $ ProfileStorage#profileFileParser_.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).loadcxx . . $ IProfileFileParser#load(4a2d2be9eefdc507).(path, profileDataFileName_cxx . . $ ProfileStorage#profileDataFileName_.);
247 if (profileData.has_valuecxx . . $ std/optional#has_value(3482b152b9333168).())
248 return profileParser_cxx . . $ ProfileStorage#profileParser_.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).loadcxx . . $ IProfileParser#load(3950ab7b6b62e024).(*cxx . . $ std/optional#`operator*`(47e1a15210ec6306).profileData, profile);
249
250 return false;
251 }