@@ -169,24 +169,17 @@ def makedir(
169
169
170
170
def move (self , src_path , dst_path , overwrite = False , preserve_time = False ):
171
171
# type: (Text, Text, bool, bool) -> None
172
- # A custom move permits a potentially optimized code path
173
172
src_fs , _src_path = self .delegate_path (src_path )
174
- dst_fs , _dst_path = self .delegate_path (dst_path )
173
+ _ , _dst_path = self .delegate_path (dst_path )
175
174
with unwrap_errors ({_src_path : src_path , _dst_path : dst_path }):
176
- if not overwrite and dst_fs .exists (_dst_path ):
177
- raise errors .DestinationExists (_dst_path )
178
- move_file (src_fs , _src_path , dst_fs , _dst_path , preserve_time = preserve_time )
175
+ _fs .move (_src_path , _dst_path , create = create , preserve_time = preserve_time )
179
176
180
177
def movedir (self , src_path , dst_path , create = False , preserve_time = False ):
181
178
# type: (Text, Text, bool, bool) -> None
182
- src_fs , _src_path = self .delegate_path (src_path )
183
- dst_fs , _dst_path = self .delegate_path (dst_path )
179
+ _fs , _src_path = self .delegate_path (src_path )
180
+ _ , _dst_path = self .delegate_path (dst_path )
184
181
with unwrap_errors ({_src_path : src_path , _dst_path : dst_path }):
185
- if not create and not dst_fs .exists (_dst_path ):
186
- raise errors .ResourceNotFound (dst_path )
187
- if not src_fs .getinfo (_src_path ).is_dir :
188
- raise errors .DirectoryExpected (src_path )
189
- move_dir (src_fs , _src_path , dst_fs , _dst_path , preserve_time = preserve_time )
182
+ _fs .movedir (_src_path , _dst_path , create = create , preserve_time = preserve_time )
190
183
191
184
def openbin (self , path , mode = "r" , buffering = - 1 , ** options ):
192
185
# type: (Text, Text, int, **Any) -> BinaryIO
0 commit comments