How to work with file paths in UriBuilder on linux

Viewed 133

When running this simple program on linux it will throw exception System.UriFormatException: Invalid URI: The hostname could not be parsed..

using System;
                    
public class Program
{
    public static void Main()
    {
        var b = new UriBuilder("/path/to/file");
        Console.WriteLine(b.ToString());
    }
}

If I try to pass Uri instead of string I'm getting The format of the URI could not be determined.

However on windows path like "C:\\path\to\file" can be parsed without a problem. How can I process such paths on linux?

0 Answers
Related