Skip to content
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

let user know working directory will be used as content root path by default #82445

Merged
merged 4 commits into from
Apr 26, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.IO;
using System.Runtime.Versioning;
using System.Threading;
using System.Threading.Tasks;
Expand Down Expand Up @@ -79,6 +80,11 @@ private void OnApplicationStarted()
Logger.LogInformation("Application started. Press Ctrl+C to shut down.");
Logger.LogInformation("Hosting environment: {EnvName}", Environment.EnvironmentName);
Logger.LogInformation("Content root path: {ContentRoot}", Environment.ContentRootPath);

if (Path.GetFullPath(Environment.ContentRootPath).Equals(Path.GetFullPath("."), StringComparison.InvariantCultureIgnoreCase))
Copy link
Contributor

Choose a reason for hiding this comment

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

Path.GetFullPath(".")

Envrionment.CurrentDirectory?

InvariantCultureIgnoreCase

wrong on unix?

Copy link
Contributor Author

@pedrobsaila pedrobsaila Feb 22, 2023

Choose a reason for hiding this comment

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

Envrionment.CurrentDirectory ?

Envrionment.CurrentDirectory when !DisableDefaults, and AppContext.BaseDirectory elsewhere

wrong on unix?

This project uses OrdinalIgnoreCase for string comparison so I'm using Ordinal to be unix compliant

{
Logger.LogWarning("Current working directory is /. If Content root path is not set explicitly, then working directory is used by default.");
}
}

private void OnApplicationStopping()
Expand Down