-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Emit relative path to output #8692
Emit relative path to output #8692
Conversation
src/MSBuild/LiveLogger/LiveLogger.cs
Outdated
|
||
// If the output path is under the initial working directory, make the console output relative to that to save space. | ||
if (outputPathSpan.StartsWith(_initialWorkingDirectory.AsSpan(), FileUtilities.PathComparison) | ||
&& (outputPathSpan[_initialWorkingDirectory.Length] == Path.DirectorySeparatorChar |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not possible for outputPathSpan
to be the same as _initialWorkingDirectory
to cause a crash here, is it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm. Not normally, but we can't control what projects might emit, so we should definitely guard against this.
A top comment from the folks who've seen this is that the absolute paths take up a bunch of space and making them relative would be a UX nicety. This is the simplest possible approach for that: string prefix truncation with no path comparison anything.