This repository was archived by the owner on Nov 13, 2026. It is now read-only.
Repository navigation
Implement PalGetModuleFileName for Unix - #1004
Merged
Merged
Conversation
Member
|
@dotnet-bot test this please |
| int numUtf8Chars = RuntimeImports.RhGetModuleFileName(moduleBase, out pModuleNameUtf8); | ||
| // Number of UTF-16 chars is always less than or equal to the number of UTF-8 ones, | ||
| char* pModuleName = stackalloc char[numUtf8Chars]; | ||
| int numChars = System.Text.Encoding.UTF8.GetChars(pModuleNameUtf8, numUtf8Chars, pModuleName, numUtf8Chars); |
Member
There was a problem hiding this comment.
This should rather be:
return System.Text.Encoding.UTF8.GetString((byte*)pModuleNameUtf8, numUtf8Chars);
Member
|
LGTM modulo comment |
This change implements PalGetModuleFileName for Unix. Since the module name passed to us is a utf-8 string, I have modified the signature of the function to use TCHAR and then modified managed RhGetModuleFileName interop signature to use byte* for Unix instead of char*. And I have also modified the called of this function, the TryGetFullPathToApplicationModule, to perform conversion of that to regular string.
janvorli
force-pushed
the
pal-get-module-filename
branch
from
March 11, 2016 17:45
b31496f to
096c82d
Compare
Member
Author
|
@dotnet-bot test OSX Debug please |
janvorli
added a commit
that referenced
this pull request
Mar 12, 2016
Implement PalGetModuleFileName for Unix
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
This change implements PalGetModuleFileName for Unix. Since the module name
passed to us is a utf-8 string, I have modified the signature of the function
to use TCHAR and then modified managed RhGetModuleFileName interop signature
to use byte* for Unix instead of char*. And I have also modified the caller
of this function, the TryGetFullPathToApplicationModule, to perform
conversion of that to .NET string.
I have also modified the RhConfig::GetConfigPath so that it works on Unix too now that
it can extract the module path.