Code a File Path that works in both OSX and Windows (dotnet core)

Viewed 2893

I have to save files in my dotnet core application. I originally developed in windows; but when I ported the code to try developing on a mac, the file path is no longer valid (i.e. "c:\content..."). Is there a way to reference a file path, in my code, that will work in both situations? We deploy to azure... so the windows file path must there too.

FileInfo fileInfo = new FileInfo("c:\\Content\\SalesOrderOutput\\" + 
      fileName.txt);
FileStream stream = fileInfo.OpenWrite();
1 Answers
Related