windows fixes
This commit is contained in:
parent
3a419b12c2
commit
a37a63d8da
4 changed files with 14 additions and 4 deletions
|
@ -570,8 +570,12 @@ class Item(db.Model):
|
||||||
for f in self.files.all():
|
for f in self.files.all():
|
||||||
path = f.fullpath()
|
path = f.fullpath()
|
||||||
if os.path.exists(path):
|
if os.path.exists(path):
|
||||||
os.unlink(path)
|
try:
|
||||||
remove_empty_folders(os.path.dirname(path))
|
os.chmod(path, stat.S_IWRITE)
|
||||||
|
os.unlink(path)
|
||||||
|
remove_empty_folders(os.path.dirname(path))
|
||||||
|
except:
|
||||||
|
pass
|
||||||
state.db.session.delete(f)
|
state.db.session.delete(f)
|
||||||
user = state.user()
|
user = state.user()
|
||||||
if user in self.users:
|
if user in self.users:
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
import stat
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import ox
|
import ox
|
||||||
|
@ -235,7 +236,11 @@ def run_import(options=None):
|
||||||
file.move()
|
file.move()
|
||||||
added += 1
|
added += 1
|
||||||
elif options.get('mode') == 'move':
|
elif options.get('mode') == 'move':
|
||||||
os.unlink(f_import)
|
try:
|
||||||
|
os.chmod(f_import, stat.S_IWRITE)
|
||||||
|
os.unlink(f_import)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
if listname:
|
if listname:
|
||||||
listitems.append(file.item.id)
|
listitems.append(file.item.id)
|
||||||
if state.activity.get('cancel'):
|
if state.activity.get('cancel'):
|
||||||
|
|
|
@ -87,6 +87,7 @@ DirReqStatistics 0
|
||||||
cwd = os.path.dirname(tor)
|
cwd = os.path.dirname(tor)
|
||||||
while self.running:
|
while self.running:
|
||||||
if sys.platform == 'win32':
|
if sys.platform == 'win32':
|
||||||
|
cwd = settings.data_path
|
||||||
startupinfo = subprocess.STARTUPINFO()
|
startupinfo = subprocess.STARTUPINFO()
|
||||||
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
|
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
|
||||||
startupinfo.wShowWindow = subprocess.SW_HIDE
|
startupinfo.wShowWindow = subprocess.SW_HIDE
|
||||||
|
|
|
@ -179,7 +179,7 @@ def install():
|
||||||
if os.path.exists(module):
|
if os.path.exists(module):
|
||||||
move(module, module_old)
|
move(module, module_old)
|
||||||
move(os.path.join(new, module), module)
|
move(os.path.join(new, module), module)
|
||||||
if os.path.exists(module_old):
|
if platform != 'win32' and os.path.exists(module_old):
|
||||||
rmtree(module_old)
|
rmtree(module_old)
|
||||||
rmtree(new)
|
rmtree(new)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue