tags:

views:

76

answers:

2

I have a ruby shell script that works perfectly on my laptop, but Dir.glob doesn't seem to work when I try and run it on my desktop.

Here is the code:

sFileTemplate = File.join("**", sResolutions, "**", "*."+sType) 
sFiles = Dir.glob(sFileTemplate)

Both machines run OSX 10.5 and are running ruby -v 1.9.1.

Am I calling glob wrong?

Thanks

A: 

I would suggest using the Ruby debug option and/or run with ktrace and try to figure out the difference.

$ ruby -rdebug problem.rb data.txt
grokus
A: 

Are you sure you have the exact same files in both locations? I haven't dug up the API on Dir.glob, but are you handling .. and . properly?

juwiley
ya, its the same exact script with one exception the !path/to/ruby is slightly different on my desktop so I had to change that...Other than that they are exactly the same. Script runs fine but glob returns an empty array on the Desktop, and an array with 100's of files on the laptop in the same dir?
Nick Faraday