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):
|
def checkFilesChanged(self, files, unchanged_for = 60):
|
||||||
now = time.time()
|
now = time.time()
|
||||||
|
file_too_new = False
|
||||||
|
|
||||||
for cur_file in files:
|
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):
|
def moveFile(self, old, dest, forcemove = False):
|
||||||
dest = ss(dest)
|
dest = ss(dest)
|
||||||
try:
|
try:
|
||||||
if forcemove:
|
if forcemove or self.conf('file_action') not in ['copy', 'link']:
|
||||||
shutil.move(old, dest)
|
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':
|
elif self.conf('file_action') == 'copy':
|
||||||
shutil.copy(old, dest)
|
shutil.copy(old, dest)
|
||||||
elif self.conf('file_action') == 'link':
|
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)
|
os.rename(old + '.link', old)
|
||||||
except:
|
except:
|
||||||
log.error('Couldn\'t symlink file "%s" to "%s". Copied instead. Error: %s. ', (old, dest, traceback.format_exc()))
|
log.error('Couldn\'t symlink file "%s" to "%s". Copied instead. Error: %s. ', (old, dest, traceback.format_exc()))
|
||||||
else:
|
|
||||||
shutil.move(old, dest)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
os.chmod(dest, Env.getPermission('file'))
|
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')
|
os.popen('icacls "' + dest + '"* /reset /T')
|
||||||
except:
|
except:
|
||||||
log.error('Failed setting permissions for file: %s, %s', (dest, traceback.format_exc(1)))
|
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:
|
except:
|
||||||
log.error('Couldn\'t move file "%s" to "%s": %s', (old, dest, traceback.format_exc()))
|
log.error('Couldn\'t move file "%s" to "%s": %s', (old, dest, traceback.format_exc()))
|
||||||
raise
|
raise
|
||||||
|
|||||||
Reference in New Issue
Block a user