Merge branch 'refs/heads/develop' into nosql
This commit is contained in:
@@ -327,6 +327,7 @@ class Plugin(object):
|
||||
|
||||
def checkFilesChanged(self, files, unchanged_for = 60):
|
||||
now = time.time()
|
||||
file_too_new = False
|
||||
|
||||
for cur_file in files:
|
||||
|
||||
|
||||
@@ -739,8 +739,15 @@ Remove it if you want it to be renamed (again, or at least let it try again)
|
||||
def moveFile(self, old, dest, forcemove = False):
|
||||
dest = ss(dest)
|
||||
try:
|
||||
if forcemove:
|
||||
shutil.move(old, dest)
|
||||
if forcemove or self.conf('file_action') not in ['copy', 'link']:
|
||||
try:
|
||||
shutil.move(old, dest)
|
||||
except:
|
||||
if os.path.exists(dest):
|
||||
log.error('Successfully moved file "%s", but something went wrong: %s', (dest, traceback.format_exc()))
|
||||
os.unlink(old)
|
||||
else:
|
||||
raise
|
||||
elif self.conf('file_action') == 'copy':
|
||||
shutil.copy(old, dest)
|
||||
elif self.conf('file_action') == 'link':
|
||||
@@ -758,8 +765,6 @@ Remove it if you want it to be renamed (again, or at least let it try again)
|
||||
os.rename(old + '.link', old)
|
||||
except:
|
||||
log.error('Couldn\'t symlink file "%s" to "%s". Copied instead. Error: %s. ', (old, dest, traceback.format_exc()))
|
||||
else:
|
||||
shutil.move(old, dest)
|
||||
|
||||
try:
|
||||
os.chmod(dest, Env.getPermission('file'))
|
||||
@@ -767,15 +772,6 @@ Remove it if you want it to be renamed (again, or at least let it try again)
|
||||
os.popen('icacls "' + dest + '"* /reset /T')
|
||||
except:
|
||||
log.error('Failed setting permissions for file: %s, %s', (dest, traceback.format_exc(1)))
|
||||
|
||||
except OSError as err:
|
||||
# Copying from a filesystem with octal permission to an NTFS file system causes a permission error. In this case ignore it.
|
||||
if not hasattr(os, 'chmod') or err.errno != errno.EPERM:
|
||||
raise
|
||||
else:
|
||||
if os.path.exists(dest):
|
||||
os.unlink(old)
|
||||
|
||||
except:
|
||||
log.error('Couldn\'t move file "%s" to "%s": %s', (old, dest, traceback.format_exc()))
|
||||
raise
|
||||
|
||||
Reference in New Issue
Block a user