question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Make FilePath and DirectoryPath comparable by value

See original GitHub issue

Currently 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:closed
  • Created 3 years ago
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
franciscomoloureirocommented, Oct 26, 2021

Noted. I will take care of this one then 😃

0reactions
cake-build-botcommented, Nov 27, 2021

🎉 This issue has been resolved in version v2.0.0 🎉

The release is available on:

Your GitReleaseManager bot 📦🚀

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found