From: Jeremy Bopp Date: 2012-10-29T23:36:16+09:00 Subject: Re: Running a Ruby script through a shortcut on a different drive. On 10/29/2012 09:26 AM, Joel Pearson wrote: > Thanks Jeremy! I'd forgotten about that option. > Because my program also runs on some computers as an exe made by Ocra > (another complication), I've added a bit of code at the start that uses > File.dirname(__FILE__) if Dir.pwd evaluates as the root. It's not > perfect but no one should be running this from a root drive anyway. I'll > change the shortcut as well. Unless there is a good reason to do otherwise, you may want to unconditionally use the File.dirname(__FILE__) trick. There are plenty of other ways for that Start in option to be busted where it isn't set to the root directory of a drive. I suppose the way Ocra works may complicate things there though. Another option would be to add an argument for the script that would specify the log directory. You could make that argument optional by falling back to the File.dirname trick if the argument isn't specified. BTW, you might want to try doing File.dirname($0) instead of using __FILE__ here. I think that may work as you would expect even with Ocra. -Jeremy