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
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.Side idea/discussion: Expose and accept
DirectoryandFileobjects 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