mirror of
https://github.com/upa/mscp.git
synced 2026-02-04 03:24:58 +08:00
fix wrong dst path for source path under '/'
When a source file path is /FILE, its dest path would be dst/ILE. This commit fixes this issue (#8).
This commit is contained in:
@@ -46,8 +46,10 @@ class File():
|
||||
with open(self.path, "wb") as f:
|
||||
f.write(os.urandom(self.size))
|
||||
|
||||
def cleanup(self):
|
||||
def cleanup(self, preserve_dir = False):
|
||||
os.remove(self.path)
|
||||
if preserve_dir:
|
||||
return
|
||||
tmp = os.path.dirname(self.path)
|
||||
while tmp and not tmp in [".", "/"]:
|
||||
if len(os.listdir(tmp)) == 0:
|
||||
|
||||
Reference in New Issue
Block a user