Fixes for ulha rmdir and copyin commands

This commit is contained in:
2019-06-30 15:51:41 +02:00
parent 3d269303d9
commit f0a9e5f85d
2 changed files with 19 additions and 17 deletions

10
ulha
View File

@@ -106,8 +106,9 @@ class ULha(Archive):
def rmdir(self, dst):
"""Remove empty directory"""
dst = self._get_real_name(dst)
if not dst.endswith(os.path.sep):
dst += os.path.sep
if not dst.endswith(bytes(os.path.sep, 'utf-8')):
dst += bytes(os.path.sep, 'utf-8')
if self._call_command('delete', dst=dst) is None:
return 1
@@ -148,12 +149,13 @@ class ULha(Archive):
os.chdir(tmpdir)
if src:
os.makedirs(os.path.dirname(dst))
os.link(src, dst)
shutil.copy2(src, dst)
else:
os.makedirs(dst)
try:
result = check_call([self.ARCHIVER, self.CMDS["write"],
result = check_call([self.ARCHIVER.decode('utf-8'),
self.CMDS["write"].decode('utf-8'),
arch_abspath, dst])
except CalledProcessError:
return 1