auto-t: iwd.py: allow renaming in copy_to_storage
By providing a 'name' keyword argument the file copied will be renamed to that.
This commit is contained in:
parent
78f5a5dde4
commit
3adb91fc9e
|
@ -1152,11 +1152,14 @@ class IWD(AsyncOpAbstract):
|
||||||
fo.close()
|
fo.close()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def copy_to_storage(source, storage_dir=IWD_STORAGE_DIR):
|
def copy_to_storage(source, storage_dir=IWD_STORAGE_DIR, name=None):
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
assert not os.path.isabs(source)
|
assert not os.path.isabs(source)
|
||||||
|
|
||||||
|
if name:
|
||||||
|
storage_dir += '/%s' % name
|
||||||
|
|
||||||
shutil.copy(source, storage_dir)
|
shutil.copy(source, storage_dir)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
Loading…
Reference in New Issue