IFileSystem.fileExists returns false even when a file exists.
See original GitHub issueThis breaks conda
and virtual environments
- These environments are no longer listed as interpreters, hence absolutely nothing works for conda or virtual environments.
In master. I believe the logic of checking the file stat is incorrect. We’re checking if the file type == FIle when checking if a file exists. However fstat could indicate that its a symbolic link.
Not sure this is the issue, but likely. Either way still is incorrect.
I.e. I don’t think we should be comparing == File
, we might want to check if !== Directory
instead. I.e. allow other values except directory. I.e. its possible Unknown
could be returned for a file (just as with symbolic links & others).
Proposed solution
- If checking for a file, then ensure fstat !== direcrtory
- If checking for a directory, then ensure fstat !== file
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Why does System.IO.File.Exists(string path) return false?
The Exists method returns false if any error occurs while trying to determine if the specified file exists. This can occur in situations...
Read more >File.Exists(String) Method (System.IO) - Microsoft Learn
Determines whether the specified file exists. ... This method also returns false if path is null , an invalid path, or a zero-length...
Read more >File.exists(filename) is not working properly my file name ...
The Exists method returns false if any error occurs while trying to determine if the specified file exists. This can occur in situations...
Read more >FileSystemObject's FileExists function returns false for existing ...
Hi, my friends: Strange things happen when I use Scripting.FileSystemObject to read local files. For an existing file, sometimes FileExists returns true, ...
Read more >An Empirical Study of Testing File-System ... - CiteSeerX
particular entry file exists (using the FileExists method of IFileSystem) and whether a metadata folder exists. (using the DirectoryExists method of ...
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 Free
Top 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
The problem is we’re treating the
FileType
as an enum and comparing===
. However these are bit values and we need to use bitwise operations.Right. I have a fix for that. 😃