Skip to content

add "Hide Name in Crashlogs" option#2010

Open
TheSillyDoggo wants to merge 5 commits intogeode-sdk:mainfrom
TheSillyDoggo:hide-username-option
Open

add "Hide Name in Crashlogs" option#2010
TheSillyDoggo wants to merge 5 commits intogeode-sdk:mainfrom
TheSillyDoggo:hide-username-option

Conversation

@TheSillyDoggo
Copy link
Copy Markdown
Contributor

@TheSillyDoggo TheSillyDoggo commented Apr 6, 2026

Tested on macOS and Linux (proton)
image

image

@matcool
Copy link
Copy Markdown
Member

matcool commented Apr 6, 2026

replace with <user> or even *** imo.. {USERNAME} is noisy

@TheSillyDoggo
Copy link
Copy Markdown
Contributor Author

TheSillyDoggo commented Apr 6, 2026

changed to "<user>"


#if defined(GEODE_IS_WINDOWS) || defined(GEODE_IS_MACOS)
if (Mod::get()->getSettingValue<bool>("hide-user-in-crashlogs")) {
const char* user = std::getenv("USER");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't think USER is defined on windows, you might be better off using the apis provided by the os like GetUserName
(if you had objective c you could use NSUserName on mac but unfortunately you are stuck with environment variables)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mac has objc crashlog
actually why not add it as geode util
getLocalUsername

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i did env variable so i could hide linux username, the winapi function just returns "steamuser"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if its not useful to expose it can be a private func

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rather internal util

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we do have a way to check for wine, so if you want that behavior (which makes sense to do on linux) then i'd only do it when wine is detected
also as alk said, this might be best as a proper geode util, which we definitely would want working correctly on both wine and non-wine gd

Copy link
Copy Markdown
Member

@Cvolton Cvolton Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

USER env variable is not defined on native Windows, USERNAME is (which should return the same thing as GetUserName, which means steamuser in Wine)

The current approach won't work on native Windows. Not personally sure if we should have a Geode util return the Linux username inside of Wine, I feel like getting steamuser would be more expected, though I can see that returning the Linux username would be more useful for this use case.

@dankmeme01
Copy link
Copy Markdown
Member

the entire way of replacing the username is a bit hacky, afaik there's only two places where the username can appear so it's cleaner to just sanitize these parts instead of running find and replace on the entire text.

I would suggest modifying CrashContext::initialize to just iterate over all images in the end and remove username from the path, and then do the same for stack frames and their file member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants