I am getting strange behavior running the following test case:
- Create a file on filesystem (created D:/auz.dat)
- Check to see if the created file exists by running
- The code returns True
- Run File.exist?(“D:/aux.dat”) (this file does not exists and should
- It returns True.
The only file that should exist is auz.dat. Looking for auu.dat or other
variations do not consistently return false and looking for aux.dat
falsely returns true every time.
File.file? seems to act the same.
I am new to Ruby and am seeing this behavior in windows (one-click
install) on any version higher than 1.8.2. On 1.8.2 it behaves as I
think it should. I am currently using 1.8.5 and cannot recreate this
behavior in linux - it seems to be specific to the windows installs I
have tried it on.
So any feedback would be appreciated - it could just be something simple
I am doing wrong. Thanks in advance.
(small test I wrote for this)
fileToTest = "D:/aux.dat" puts 'Checking for file: ' + fileToTest if File.exist?(fileToTest) puts 'file is there' else puts 'file not found' end