Make FilePath and DirectoryPath comparable by value
See original GitHub issueCurrently FilePath
and DirectoryPath
comparisons are done by reference, and identical paths in different instances are considered to be different.
Example
var file1 = FilePath.FromString("./MyApp.csproj");
var file2 = FilePath.FromString("./MyApp.csproj");
Information("file1 == file2: {0}", file1 == file2);
// ...
var directory1 = DirectoryPath.FromString("./artifacts");
var directory2 = DirectoryPath.FromString("./artifacts");
Information("directory1 == directory2: {0}", directory1 == directory2);
What You Are Seeing?
C:\augustoproiete\cake\1.0.0-rc0003>dotnet cake test-compare-filepath.cake
file1 == file2: False
directory1 == directory2: False
What is Expected?
C:\augustoproiete\cake\1.0.0-rc0003>dotnet cake test-compare-filepath.cake
file1 == file2: True
directory1 == directory2: True
What version of Cake are you using?
1.0.0-rc0003
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (7 by maintainers)
Top Results From Across the Web
How can I compare (directory) paths in C#? - ...
GetFullPath seems to do the work, except for case difference ( Path.GetFullPath("test") != Path.GetFullPath("TEST") ) and trailing slash.
Read more >File and Directory Names: File, Path, Paths (Java Files ...
A relative path is related to the current position within the file system. It describes how to get from this position to the...
Read more >Path compareTo() method in Java with Examples
Path ) method of java.nio.file.Path used to compare two abstract paths lexicographically. Two paths can be compared by this method.
Read more >Path Operations - Essential Java Classes
A Path instance contains the information used to specify the location of a file or directory. At the time it is defined, a...
Read more >Java – Path vs File
In Java, Path and File are classes responsible for file I/O operations. They perform the same functions but belong to different packages.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Noted. I will take care of this one then 😃
🎉 This issue has been resolved in version v2.0.0 🎉
The release is available on:
Your GitReleaseManager bot 📦🚀