#encoding: UTF-8 # This script shall verify that the Windows PATH can # be read and its values be split using Ruby require "logger" $LOG = Logger.new(STDOUT) $LOG.level = Logger::INFO def test_path pathdirs = ENV['PATH'].split(File::PATH_SEPARATOR).collect do |d| pdir = nil if(Dir.exist?(d) ) if(File.readable?(d) ) # create a non nil entry for pathdirs. begin pdir = Dir.new(d) rescue Exception => ex # "Trust nobody" (Herod V) $LOG.error('Cannot search for executables in ' << d << ': ' << ex.message ) end else $LOG.warn('The path-variable references an unreadable directory: ' << d) end else $LOG.warn('The path-variable contains an invalid value: ' << d) end pdir.path if pdir end pathdirs.join(', ') end if __FILE__ == $0 $LOG.info( test_path) end