windows fixes

This commit is contained in:
j 2016-02-23 17:27:15 +05:30
parent 3a419b12c2
commit a37a63d8da
4 changed files with 14 additions and 4 deletions

View File

@ -570,8 +570,12 @@ class Item(db.Model):
for f in self.files.all():
path = f.fullpath()
if os.path.exists(path):
os.unlink(path)
remove_empty_folders(os.path.dirname(path))
try:
os.chmod(path, stat.S_IWRITE)
os.unlink(path)
remove_empty_folders(os.path.dirname(path))
except:
pass
state.db.session.delete(f)
user = state.user()
if user in self.users:

View File

@ -5,6 +5,7 @@
from datetime import datetime
import os
import shutil
import stat
import time
import ox
@ -235,7 +236,11 @@ def run_import(options=None):
file.move()
added += 1
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:
listitems.append(file.item.id)
if state.activity.get('cancel'):

View File

@ -87,6 +87,7 @@ DirReqStatistics 0
cwd = os.path.dirname(tor)
while self.running:
if sys.platform == 'win32':
cwd = settings.data_path
startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
startupinfo.wShowWindow = subprocess.SW_HIDE

View File

@ -179,7 +179,7 @@ def install():
if os.path.exists(module):
move(module, module_old)
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(new)
else: