Merge pull request 'VIS-48' (#10) from VIS-48 into master

Reviewed-on: #10
This commit is contained in:
Helena Gałązka 2021-01-25 16:26:53 +01:00
commit 7a74c39e14

View File

@ -23,9 +23,17 @@ def files(path):
yield os.path.join(subdir, file) yield os.path.join(subdir, file)
def save_input(oldpath): def save_input(oldpath):
# make timestampt the filename, so it wouln't overwrite # add timestamp to the filename, so it wouln't overwrite but the user still knows which file's which
timestamp = str(int(time.time())) timestamp = str(int(time.time()))
filename = timestamp + '.' + oldpath.split('.')[-1] basename = os.path.basename(oldpath)
try:
basename.index('.')
basename_no_extension = basename[:basename.index('.')]
extension = basename[index_of_dot:]
except ValueError:
basename_no_extension = basename
extension = ''
filename = basename_no_extension + '_' + timestamp + extension
newpath = inputFilePath + '\\' + filename newpath = inputFilePath + '\\' + filename
shutil.copy(oldpath, newpath) shutil.copy(oldpath, newpath)
return newpath return newpath