Sitelet https://github.com/DiscUtils/DiscUtils/issues/50
Skip to content

Evaluate use of slashes in path code #50

Description

@LordMike

In DiscUtils, we use \ for all path things, which works great in Windows but will give troubles in Linux. In .NET, Path.* methods give different results based on the OS.

Code Windows Linux
Path.GetFileName("C:\\Windows\\File.exe") File.exe C:\Windows\File.exe
Path.GetDirectoryName("C:\\Windows\\File.exe") C:\Windows <empty>
Path.Combine("C:\\Windows", "File.exe") C:\Windows\File.exe C:\Windows/File.exe

Side idea/discussion: Expose and accept Directory and File objects that mask strings and can freely convert to/from. Internally they will represent their paths as an array of strings, allowing us to know both the type of path and the segments of it.

Related: #36

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions