lib/fog/local/models/storage/files.rb in fog-maestrodev-1.8.0.20130114204828 vs lib/fog/local/models/storage/files.rb in fog-maestrodev-1.14.0.20130806165225
- old
+ new
@@ -12,22 +12,22 @@
model Fog::Storage::Local::File
def all
requires :directory
if directory.collection.get(directory.key)
- pwd = Dir.pwd
- Dir.chdir(service.path_to(directory.key))
- data = Dir.glob('**/*').reject do |file|
- ::File.directory?(file)
- end.map do |key|
- path = file_path(key)
- {
- :content_length => ::File.size(path),
- :key => key,
- :last_modified => ::File.mtime(path)
- }
- end
- Dir.chdir(pwd)
+ data = []
+ Dir.chdir(service.path_to(directory.key)) {
+ data = Dir.glob('**/*').reject do |file|
+ ::File.directory?(file)
+ end.map do |key|
+ path = file_path(key)
+ {
+ :content_length => ::File.size(path),
+ :key => key,
+ :last_modified => ::File.mtime(path)
+ }
+ end
+ }
load(data)
else
nil
end
end