File tree Expand file tree Collapse file tree 2 files changed +13
-9
lines changed
main/java/org/apache/hadoop/fs/glusterfs
test/java/org/gluster/test Expand file tree Collapse file tree 2 files changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -180,14 +180,18 @@ public boolean exists(Path path) throws IOException {
180
180
return f .exists ();
181
181
}
182
182
183
- public boolean mkdirs (Path f , FsPermission permission ) throws IOException {
184
-
185
- if (f ==null ) return true ;
186
-
187
- Path parent = f .getParent ();
188
- Path absolute = makeAbsolute (f );
189
- File p2f = new File (absolute .toUri ().getPath ());
190
- return (f == null || mkdirs (parent )) && (p2f .mkdir () || p2f .isDirectory ());
183
+ public boolean mkdirs (Path path , FsPermission permission )
184
+ throws IOException {
185
+ boolean created = false ;
186
+ Path absolute = makeAbsolute (path );
187
+ File f = new File (absolute .toUri ().getPath ());
188
+
189
+ if (f .exists ()) {
190
+ System .out .println ("Directory " + f .getPath () + " already exist" );
191
+ return true ;
192
+ }
193
+
194
+ return f .mkdirs ();
191
195
}
192
196
193
197
@ Deprecated
Original file line number Diff line number Diff line change @@ -138,7 +138,7 @@ public static void before() throws Exception{
138
138
139
139
@ org .junit .Test
140
140
public void testTolerantMkdirs () throws Exception {
141
-
141
+ System . out . println ( "Testing tollerance of mkdirs(a/b/c/d) then mkdirs(a/b/c)" );
142
142
Path longPath = new Path ("a/b/c/d" );
143
143
assertFalse (gfs .exists (longPath ));
144
144
gfs .mkdirs (longPath );
You can’t perform that action at this time.
0 commit comments