dotnet / systemweb-adapters

MIT License
337 stars 59 forks source link

Support `HostingEnvironment.MapPath` #460

Open AvremelM opened 9 months ago

AvremelM commented 9 months ago

Summary

Support HostingEnvironment.MapPath in SystemWebAdapters.

Motivation and goals

twsouthwick commented 9 months ago

This was (I believe) intended to be added as part of https://github.com/dotnet/systemweb-adapters/issues/368, but was omitted for some reason, perhaps unintentionally.

Yup, it was planned to be a part of that, but got left out. I believe the building blocks should be there - would you be able to submit a PR to enable it?

AvremelM commented 8 months ago

I may be able to if I find time. I'll have to take a closer look at how things are usually done in this repo, I'd rather not submit noncompliant code if I can help it.

AvremelM commented 8 months ago

@twsouthwick Is there any documentation or discussions in this project about copying over (and adapting) code from @microsoft/referencesource? I.e., Are we allowed to? Is it even worth the effort? Is it a bad idea to even try?

twsouthwick commented 8 months ago

Is there any documentation or discussions in this project about copying over (and adapting) code from @microsoft/referencesource? I.e., Are we allowed to? Is it even worth the effort? Is it a bad idea to even try?

Yup that's how we've done it. microsoft/referencesource was changed to the MIT license a few years back specifically for these kinds of efforts (https://github.com/microsoft/referencesource?tab=readme-ov-file#license). There are still some files that are licensed differently, but as long as you're not using one of those, it's fine

twsouthwick commented 7 months ago

@AvremelM did you want to supply a PR for this?

AvremelM commented 7 months ago

Last I looked into it I think I wasn't sure how best to go about it while maintaining the original framework's (undocumented) functionalities, esp all the stuff in HostingEnvironment.MapPathActual.

It's on my eventual list, but I don't have anything ready at the moment, (and in the meantime I was waiting to see what happens with my other PRs to learn more about contributing).

twsouthwick commented 7 months ago

We have a IMapPathUtility that you could start with. I wouldn't say you need all the functionality to start with, just the basic stuff. We could always expose the IMapPathUtility so additional functionality could be overwritten there to light up scenarios you need after the fact.

twsouthwick commented 7 months ago

If you do decide to do that, feel free to add some comments in the code as to what is being excluded from the original implementation for posterity