MCPcopy Create free account
hub / github.com/amule-project/amule / InstallIcons

Function InstallIcons

src/AppImageIntegration.cpp:132–168  ·  view source on GitHub ↗

Walk $APPDIR/usr/share/icons/hicolor and mirror the org.amule.aMule.* PNG files into ~/.local/share/icons/hicolor preserving the size subdirs. Best-effort: any single copy failure is logged but doesn't abort the rest.

Source from the content-addressed store, hash-verified

130// files into ~/.local/share/icons/hicolor preserving the size subdirs.
131// Best-effort: any single copy failure is logged but doesn't abort the rest.
132bool InstallIcons(const wxString& appdir, const wxString& userIconsDir)
133{
134 const wxString sourceHicolor = appdir + wxT("/usr/share/icons/hicolor");
135 if (!wxDirExists(sourceHicolor)) {
136 AddDebugLogLineC(logGeneral,
137 wxT("AppImageIntegration: hicolor tree missing at ") + sourceHicolor);
138 return false;
139 }
140
141 wxArrayString found;
142 wxDir::GetAllFiles(sourceHicolor, &found, wxT("org.amule.aMule.*"), wxDIR_FILES | wxDIR_DIRS);
143 if (found.IsEmpty()) {
144 AddDebugLogLineC(logGeneral,
145 wxT("AppImageIntegration: no org.amule.aMule.* icons under ") + sourceHicolor);
146 return false;
147 }
148
149 bool anyOk = false;
150 for (size_t i = 0; i < found.GetCount(); ++i) {
151 const wxString& src = found[i];
152 wxString relative = src.Mid(sourceHicolor.length());
153 wxString dest = userIconsDir + wxT("/hicolor") + relative;
154
155 wxFileName destPath(dest);
156 if (!destPath.DirExists()) {
157 destPath.Mkdir(0755, wxPATH_MKDIR_FULL);
158 }
159
160 if (wxCopyFile(src, dest, true)) {
161 anyOk = true;
162 } else {
163 AddDebugLogLineC(logGeneral,
164 wxT("AppImageIntegration: copy failed: ") + src + wxT(" -> ") + dest);
165 }
166 }
167 return anyOk;
168}
169
170// update-desktop-database and gtk-update-icon-cache exist on every desktop
171// distro that ships a .desktop file system, but we don't fail integration

Callers 1

PromptAndInstallFunction · 0.85

Calls 3

DirExistsMethod · 0.80
IsEmptyMethod · 0.45
GetCountMethod · 0.45

Tested by

no test coverage detected