118: def self.recmkdir(dir,mode = 0755)
119: if FileTest.exist?(dir)
120: return false
121: else
122: tmp = dir.sub(/^\//,'')
123: path = [File::SEPARATOR]
124: tmp.split(File::SEPARATOR).each { |dir|
125: path.push dir
126: if ! FileTest.exist?(File.join(path))
127: Dir.mkdir(File.join(path), mode)
128: elsif FileTest.directory?(File.join(path))
129: next
130: else FileTest.exist?(File.join(path))
131: raise "Cannot create %s: basedir %s is a file" %
132: [dir, File.join(path)]
133: end
134: }
135: return true
136: end
137: end