Reputation: 67
I have some problems with this Code. It says, i am using a wrong directory. I want to change the directory path through user-input with "gets" (e_path=gets ; subdirs(epath)). Any suggestions?
when I use subdirs("/home/etc/") everything works fine.
def subdirs(path)
subdirs =[]
folderdirs=[]
Dir.chdir(path)
Dir["*"].each do |x|
if File.directory? File.join x
subdirs << x
else
folderdirs << x
end
end
puts "____________________________"
puts "Projekte:\n\n"
puts subdirs
puts "____________________________"
puts "Datein:\n\n"
puts folderdirs
end
. . .
puts "\n\nGeben Sie bitte den Pfad ein um ein Workspace zu erstellen:"
e_path=gets
sleep(1)
subdirs(e_path) #Here is the mistake
Upvotes: 1
Views: 70