Skip to content

Conversation

@mitchell-merry
Copy link
Contributor

@mitchell-merry mitchell-merry commented Dec 26, 2025

This is something I needed to access for my scene manager stuff (need to access the range of the main module without changing the API of SceneManager::attach.

I imagine it could be useful elsewhere too.

I'm inferring the name of the main module is the same as the name of the process - I think this is a safe assumption, but let me know if not.

@Jujstme
Copy link
Collaborator

Jujstme commented Dec 26, 2025

Two quick observations:

  1. You are allocating a string, requiring those functions to be hidden behind a #[cfg(feature = "alloc")], however you can probably use anArrayCString instead.
  2. If I remember correctly, despite the fixes pushed by Cryze recently on the runtime, Process::get_path() can still fail if the process is inside special directories.

@mitchell-merry
Copy link
Contributor Author

Two quick observations:

  1. You are allocating a string, requiring those functions to be hidden behind a #[cfg(feature = "alloc")], however you can probably use anArrayCString instead.
  2. If I remember correctly, despite the fixes pushed by Cryze recently on the runtime, Process::get_path() can still fail if the process is inside special directories.
  1. Yeah, but I'm calling get_path anyways which already allocates a string, so I don't think there's a way around it. Besides, I don't find ArrayCStrings very practical to use, I almost always want a string (if there's a way around it, I'm happy to introduce a get_name_as_string version instead)

  2. Special directories, as in network drives? Seems like something that needs to be fixed separately still and not something I need to consider here - my first choice would have been to store the process name on the type itself so we don't need to re-calculate it, but Process is not a struct.

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.

3 participants