Skip to content

Posix path using wrong separator #21

Description

@MattAlanWright

The code snippet below:

class Program
{
    static void Main(string[] args)
    {
        const string stringPath = @"/this/is/a/file\named\this.txt";
        PurePosixPath posixPath = new(stringPath);
        Console.WriteLine(posixPath.Directory);
        Console.WriteLine(posixPath.Filename);
    }
}

prints the following when run on my Windows machine:

/this/is/a/file/named
this.txt

Clearly it is interpreting the '\' characters as path separators. However, these are valid filename characters under Posix and I would expect the following output:

/this/is/a
file\named\this.txt

I assume this is related to running on Windows. However my understanding was that the Pure path types don't care what machine they are being run on. Being able to easily manipulate either Windows or Posix paths from a Windows machine, is what initially drew me to this library.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions