I have an Array of Strings and I want to select only these Strings which are paths to files:
My path is "~/dlds/some_file.ics"
where ~/dlds
is a symlink to ~/archive/downloads
on my system. The file has following permissions:
-rw-r--r--
My code (I tried several variants):
ARGV.select do |string|
File.file? string # returns false
Pathname.new(string).file? # returns false
Pathname.new(string).expand_path.file? # returns false
end
I don't know what else to try.
I'm running Ruby 2.2.0 or 2.2.2.
ARGV
please – Allotment~/
directory. To check it try to pass the full path ie/home/user/dlds/some_file.ics
– Allotment["--debug", "~/dlds/some_file"]
. Using a full path doesn't work as well.. – Dandridge