forked from p15670423/monkey
os.path.samefile does not work on windows. My code checks if files handlers are the same instead
This commit is contained in:
parent
3118620c8a
commit
dfecc6d6ac
|
@ -56,7 +56,10 @@ class MonkeyDrops(object):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# we copy/move only in case path is different
|
# we copy/move only in case path is different
|
||||||
file_moved = os.path.samefile(self._config['source_path'], self._config['destination_path'])
|
try:
|
||||||
|
file_moved = os.stat(self._config['source_path']) == os.stat(self._config['destination_path'])
|
||||||
|
except OSError:
|
||||||
|
file_moved = False
|
||||||
|
|
||||||
if not file_moved and os.path.exists(self._config['destination_path']):
|
if not file_moved and os.path.exists(self._config['destination_path']):
|
||||||
os.remove(self._config['destination_path'])
|
os.remove(self._config['destination_path'])
|
||||||
|
|
Loading…
Reference in New Issue