D
dtown22
Hi,
I am a bit of a ruby newbie, and i cant figure out this problem. I am
recursively searching through some directories, and when i find the
one i want, i try to pass it to an external process, through 'system'
but the forward slashes screw things up.
i tried replacing the forward slashes through gsub, but i end up with
2 slashes. for example, if i am trying to 'dir' a path, this ends up
being sent through system:
dir c:\\myStartDir/currentDir #obviously this wont work, so i tried
using gsub, and i get this
dir c:\\myStartDir\\currentDir #and 'dir' complains it cant find the
directory.
my code looks something like this
dirPath = File.dirname(path).gsub('/', "\\")
system("dir " + dirPath)
path is determined using Find.find(c:\\myStartDir)
any help is greatly appreciated. Thanks!
I am a bit of a ruby newbie, and i cant figure out this problem. I am
recursively searching through some directories, and when i find the
one i want, i try to pass it to an external process, through 'system'
but the forward slashes screw things up.
i tried replacing the forward slashes through gsub, but i end up with
2 slashes. for example, if i am trying to 'dir' a path, this ends up
being sent through system:
dir c:\\myStartDir/currentDir #obviously this wont work, so i tried
using gsub, and i get this
dir c:\\myStartDir\\currentDir #and 'dir' complains it cant find the
directory.
my code looks something like this
dirPath = File.dirname(path).gsub('/', "\\")
system("dir " + dirPath)
path is determined using Find.find(c:\\myStartDir)
any help is greatly appreciated. Thanks!