CsvFile.Load doesn't use current directory from system.environment
I can do this:
open System.IO
System.Environment.CurrentDirectory <- __SOURCE_DIRECTORY__
File.ReadAllLines("filename")
and it picks up SOURCE_DIRECTORY\filename
but if I do this:
CsvFile.Load "filename"
It will try to load C:\Program Files (x86)\Microsoft SDKs\F#\4.1\Framework\v4.0\filename
Hi! I'd like to help out with this, but I'm wondering if I can ask a question or two first..
I might be mistaken, but it looks like it's here that AppDomain.CurrentDomain.BaseDirectory gets selected in runtime.
https://github.com/fsharp/FSharp.Data/blob/1ac5f39e7297ef386e39d68f6f73859c25867fae/src/CommonRuntime/IO.fs#L52-L57
I wonder how much code, if any, exists which relies on that behavior?
It also mentions in a comment that this base directory selection is based on standard type provider rules established here: https://github.com/fsharp/fsharpx/issues/195#issuecomment-12141785.
Like I said I'd love to help out, but I'm not sure how to proceed with those concerns, or if they're even valid.
Any thoughts?
I think the issue is that CsvFile.Load and CsvFile.Save don't go throu that piece of code like the type providers
Wouldn't it be sufficient to change AppDomain.CurrentDomain.BaseDirectory to Directory.GetCurrentDirectory()?
I also ran into this problem when starting my app with dotnet run and using relative paths there.