Open
Conversation
Open
2 tasks
Member
|
How did you write that code if you're not a C++ dev, though? |
Author
AI and linux knowledge lol |
TheAssassin
requested changes
Sep 7, 2025
Member
TheAssassin
left a comment
There was a problem hiding this comment.
Had a first glance. This is quite a lot of code and it is not clear which part solves the problem, really.
Comment on lines
+195
to
+199
| std::string baseName = desktopEntryIconName; | ||
| size_t lastDot = baseName.find_last_of('.'); | ||
| if (lastDot != std::string::npos) { | ||
| baseName = baseName.substr(lastDot + 1); | ||
| } |
Member
There was a problem hiding this comment.
This bit is duplicated at least three times. It should be a utility function.
Comment on lines
+237
to
+264
| for (const auto& path : hicolorIconPaths) { | ||
| // Extract size from path like "usr/share/icons/hicolor/512x512/apps/" | ||
| std::string sizeStr; | ||
| size_t sizePos = path.find("/hicolor/"); | ||
| if (sizePos != std::string::npos) { | ||
| sizePos = path.find('/', sizePos + 9); | ||
| if (sizePos != std::string::npos) { | ||
| size_t endPos = path.find('/', sizePos + 1); | ||
| if (endPos != std::string::npos) { | ||
| sizeStr = path.substr(sizePos + 1, endPos - sizePos - 1); | ||
| // Handle NxN format | ||
| size_t xPos = sizeStr.find('x'); | ||
| if (xPos != std::string::npos) { | ||
| try { | ||
| int size = std::stoi(sizeStr.substr(0, xPos)); | ||
| if (size > largestSize) { | ||
| largestSize = size; | ||
| largestIconPath = path; | ||
| } | ||
| } catch (...) { | ||
| // Skip invalid size format | ||
| continue; | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
Member
There was a problem hiding this comment.
This block of code is really hard to read and understand and does not actually validate the path structure. But given the amount of nested functionality, this also should be a separate function.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I am not a c++ dev - this was literally done because my cursor AppImage had no icon.
i know its not the best solution. probably going to have issues with some appimages packaging their icons in weird places