Ruby/File Directory/chdir

Материал из Wiki.crossplatform.ru

Версия от 17:10, 26 мая 2010; (Обсуждение)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

Compare a variable storing a directory path with the current directory

ruby_progs = "/Users/Ruby"
if not Dir.pwd == ruby_progs
  Dir.chdir ruby_progs
end



To change directory within a Ruby program, use Dir.chdir:

Dir.chdir("/usr/bin")