Ruby/File Directory/chdir

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

(Различия между версиями)
Перейти к: навигация, поиск
м (1 версия)
 

Текущая версия на 17:57, 13 сентября 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")