s3fsr 1.6 → 1.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/s3fsr.rb +23 -3
- metadata +3 -3
data/lib/s3fsr.rb
CHANGED
@@ -58,8 +58,8 @@ class SBaseDir
|
|
58
58
|
get_contents << SFile.new(self, AWS::S3::S3Object.find(child_key, bucket))
|
59
59
|
end
|
60
60
|
def create_dir child_key
|
61
|
-
AWS::S3::S3Object.store(child_key,
|
62
|
-
get_contents <<
|
61
|
+
AWS::S3::S3Object.store(child_key + '/', '', bucket)
|
62
|
+
get_contents << SPrefixDir.new(self, child_key + '/')
|
63
63
|
end
|
64
64
|
def delete
|
65
65
|
AWS::S3::S3Object.delete @key, bucket
|
@@ -99,7 +99,7 @@ class SBaseDir
|
|
99
99
|
end
|
100
100
|
end
|
101
101
|
s3_bucket.common_prefix_cache.reject { |p| p == '/' }.each do |prefix|
|
102
|
-
hidden =
|
102
|
+
hidden = SPrefixDir.new(self, prefix)
|
103
103
|
@data << hidden unless @data.find { |i| i.name == hidden.name }
|
104
104
|
end
|
105
105
|
break unless s3_bucket.object_cache.length > 0 && s3_bucket.object_cache.length % 1000 == 0
|
@@ -110,6 +110,26 @@ class SBaseDir
|
|
110
110
|
end
|
111
111
|
end
|
112
112
|
|
113
|
+
# for either non-existent or aws console-created fake directories that end with /
|
114
|
+
class SPrefixDir < SBaseDir
|
115
|
+
def initialize(parent, key)
|
116
|
+
@parent = parent
|
117
|
+
@key = key
|
118
|
+
@data = nil
|
119
|
+
end
|
120
|
+
def name
|
121
|
+
@key.split('/')[-1]
|
122
|
+
end
|
123
|
+
def bucket
|
124
|
+
@parent.bucket
|
125
|
+
end
|
126
|
+
private
|
127
|
+
def prefix
|
128
|
+
@key
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
# for s3sync/s3organizer fake directories
|
113
133
|
class SFakeDir < SBaseDir
|
114
134
|
def initialize(parent, key)
|
115
135
|
@parent = parent
|
metadata
CHANGED