From: Reid Thompson Date: 2009-05-12T00:44:04+09:00 Subject: File.basename bug? How often do people get bitten by this? When operating on a file in the current directory, './' must be prepended to a filename for File.basename to work... or is this unexpected behavior? $ cat bug.rb DATAFORMAT_VERSION=1 def processInputFile(inputFpath) puts "inputFpath #{inputFpath}" dirpath = File.dirname(inputFpath) outputfile = File.basename(inputFpath) outputfile.gsub!("pp_",'') outputfile = dirpath + '/' + 'SDF_' + "#{DATAFORMAT_VERSION}" + '_' + outputfile puts "outputfile #{outputfile}" puts "inputFpath #{inputFpath}" end processInputFile("pp_a_test_file_name") rthompso@raker>/home/rthompso $ ruby bug.rb inputFpath pp_a_test_file_name outputfile ./SDF_1_a_test_file_name inputFpath a_test_file_name rthompso@raker>/home/rthompso $ ruby -v ruby 1.8.7 (2009-04-08 patchlevel 160) [i686-linux] rthompso@raker>/home/rthompso $ vi bug.rb rthompso@raker>/home/rthompso $ ruby bug.rb inputFpath /home/rthompso/pp_a_test_file_name outputfile /home/rthompso/SDF_1_a_test_file_name inputFpath /home/rthompso/pp_a_test_file_name