lib/carrierwave/storage/ftp/ex_sftp.rb in carrierwave-ftp-0.2.5 vs lib/carrierwave/storage/ftp/ex_sftp.rb in carrierwave-ftp-0.2.6
- old
+ new
@@ -1,19 +1,14 @@
require 'net/sftp'
class Net::SFTP::Session
def mkdir_p!(dir)
- parts = dir.split("/")
- growing_path = ""
+ parts = dir.split(File::SEPARATOR)
+ growing_parts = []
for part in parts
- next if part == ""
- if growing_path == ""
- growing_path = part
- else
- growing_path = File.join(growing_path, part)
- end
+ growing_parts.push(part)
begin
- mkdir!(growing_path)
+ mkdir!(File.join(growing_parts))
rescue
end
end
end
end