R
Ronald Fischer
Or, rather, I probably just made a silly mistake which I can't see
(because I had a long break since I wrote my last Ruby program). Please
have a look at this program:
#!/usr/local/bin/ruby
dir=ARGV[0] or raise "Which directory?";
puts "Opening:"+dir
Dir.foreach(dir) { |entry|
puts entry
if(File.file?(entry))
puts "is a file"
end
}
No matter which directory on Max OSX 10.4 I try this out, it lists all
entries in the directory, but only for the entry ".DS_Store" (which
exists on the Mac automatically in every sub-directory), it prints out
"is a file". It is as if the other directory entries would be no
(regular) files.
What did I do wrong?
(because I had a long break since I wrote my last Ruby program). Please
have a look at this program:
#!/usr/local/bin/ruby
dir=ARGV[0] or raise "Which directory?";
puts "Opening:"+dir
Dir.foreach(dir) { |entry|
puts entry
if(File.file?(entry))
puts "is a file"
end
}
No matter which directory on Max OSX 10.4 I try this out, it lists all
entries in the directory, but only for the entry ".DS_Store" (which
exists on the Mac automatically in every sub-directory), it prints out
"is a file". It is as if the other directory entries would be no
(regular) files.
What did I do wrong?