我有:
ruby -v
=>ruby 2.3.1p112 (2016-04-26) [x86_64-linux-gnu]
puts arg_provide
=>/home/user/Bureau/Clips graver
input_file_or_directory = Shellwords.shellescape(arg_provide).to_s
puts input_file_or_directory
=>/home/user/Bureau/Clips\ graver
我什么时候
Dir.foreach("/home/user/Bureau/Clips\ graver") do |media|
=> IT'S WORKS FINE!
但是当我这样做时
Dir.foreach(input_file_or_directory) do |media|
=>Raise Uncaught exception: No such file or directory @ dir_initialize
- /home/user/Bureau/Clips\ graver
我无法弄明白 有人帮帮我吗?
答案 0 :(得分:0)
替换
Dir.foreach(arg_provideinput_file_or_directory)
与
Dir.foreach(arg_provide.to_s)