[#47049] fileのopenに関する動作についての質問 — 高橋作郎 <sakurou3960@...>

はじめまして。

14 messages 2010/05/04

[ruby-list:47081] FileTest.directory?(ディレクトリ)が no になる

From: sw@...
Date: 2010-05-13 01:14:35 UTC
List: ruby-list #47081
RUBY_VERSION=1.8.7
RUBY_PLATFORM=i386-mswin32
です。
ディレクトリ a, b があり、a をカレントディレクトリにしてスクリプト
#--------------------------------------------------
Dir.foreach("..") do |d|
	if FileTest.directory?(d)
		print "#{d} is directory\n"
	else
		print "#{d} is not directory\n"
	end
end
#--------------------------------------------------
を実行すると下のようになります。
a, b はディレクトリなのに何故こうなるのでしょうか?
. is directory
.. is directory
a is not directory
b is not directory

In This Thread

Prev Next