R
RichardOnRails
I've got the Ruby script:
require "fileutils"
path = "K:/_Utilities/Apache/xampp/"
FileUtils::cd path
names = Dir.glob("**/index.html")
(0..4).each { |i|
name = names
address = "file://" + path + name
puts address
exec address
}
With the final statement (exec address) commented out, I get:
K:\>ruby K:\_Projects\Ruby\_Ruby_Tests\TestDirTraversal
\TestDirTraversal.rb
file://K:/_Utilities/Apache/xampp/apache/htdocs/index.html
file://K:/_Utilities/Apache/xampp/htdocs/index.html
file://K:/_Utilities/Apache/xampp/htdocs/restricted/index.html
file://K:/_Utilities/Apache/xampp/licenses/gd/index.html
file://K:/_Utilities/Apache/xampp/php/docs/Structures_Graph/docs/html/index.html
With the final statement active, I get the crash:
K:\>ruby K:\_Projects\Ruby\_Ruby_Tests\TestDirTraversal
\TestDirTraversal.rb
file://K:/_Utilities/Apache/xampp/apache/htdocs/index.html
K:/_Projects/Ruby/_Ruby_Tests/TestDirTraversal/TestDirTraversal.rb:
10:in `exec': Invalid argument - file://K:/_Utilities/Apache/xampp/apache/htdocs/in
dex.html (Errno::EINVAL)
from K:/_Projects/Ruby/_Ruby_Tests/TestDirTraversal/
TestDirTraversal.rb:10:in `block in <main>'
from K:/_Projects/Ruby/_Ruby_Tests/TestDirTraversal/
TestDirTraversal.rb:6:in `each'
from K:/_Projects/Ruby/_Ruby_Tests/TestDirTraversal/
TestDirTraversal.rb:6:in `<main>'
I'm running WinXP-Pro/SP3, Ruby 1.9.2 and Firefox 5.0.
If I copy/paste these addresses into Firefox address bar, the work as
expected. If I paste them into a Word document with RETURN after each
one, I have a set of links I could click or double-click to start
them up in Firefox. Is there a way to do this in pure Ruby?
Is this the right newsgroup for this kind of question?
Thanks in advance,
Richard
require "fileutils"
path = "K:/_Utilities/Apache/xampp/"
FileUtils::cd path
names = Dir.glob("**/index.html")
(0..4).each { |i|
name = names
address = "file://" + path + name
puts address
exec address
}
With the final statement (exec address) commented out, I get:
K:\>ruby K:\_Projects\Ruby\_Ruby_Tests\TestDirTraversal
\TestDirTraversal.rb
file://K:/_Utilities/Apache/xampp/apache/htdocs/index.html
file://K:/_Utilities/Apache/xampp/htdocs/index.html
file://K:/_Utilities/Apache/xampp/htdocs/restricted/index.html
file://K:/_Utilities/Apache/xampp/licenses/gd/index.html
file://K:/_Utilities/Apache/xampp/php/docs/Structures_Graph/docs/html/index.html
With the final statement active, I get the crash:
K:\>ruby K:\_Projects\Ruby\_Ruby_Tests\TestDirTraversal
\TestDirTraversal.rb
file://K:/_Utilities/Apache/xampp/apache/htdocs/index.html
K:/_Projects/Ruby/_Ruby_Tests/TestDirTraversal/TestDirTraversal.rb:
10:in `exec': Invalid argument - file://K:/_Utilities/Apache/xampp/apache/htdocs/in
dex.html (Errno::EINVAL)
from K:/_Projects/Ruby/_Ruby_Tests/TestDirTraversal/
TestDirTraversal.rb:10:in `block in <main>'
from K:/_Projects/Ruby/_Ruby_Tests/TestDirTraversal/
TestDirTraversal.rb:6:in `each'
from K:/_Projects/Ruby/_Ruby_Tests/TestDirTraversal/
TestDirTraversal.rb:6:in `<main>'
I'm running WinXP-Pro/SP3, Ruby 1.9.2 and Firefox 5.0.
If I copy/paste these addresses into Firefox address bar, the work as
expected. If I paste them into a Word document with RETURN after each
one, I have a set of links I could click or double-click to start
them up in Firefox. Is there a way to do this in pure Ruby?
Is this the right newsgroup for this kind of question?
Thanks in advance,
Richard