Fixed an issue with temp directories in Windows.
This commit is contained in:
parent
dc554354d9
commit
a0dd0ca2f6
1 changed files with 11 additions and 3 deletions
14
main.py
14
main.py
|
|
@ -1,5 +1,5 @@
|
||||||
from utils import zip_files, join_files
|
from utils import zip_files, join_files
|
||||||
import sys, os, glob, json, re, shutil, stat, tarfile, zipfile, traceback
|
import sys, os, glob, json, re, shutil, stat, tarfile, zipfile, traceback, platform
|
||||||
from PySide import QtGui, QtCore
|
from PySide import QtGui, QtCore
|
||||||
from PySide.QtGui import QApplication
|
from PySide.QtGui import QApplication
|
||||||
from PySide.QtNetwork import QHttp
|
from PySide.QtNetwork import QHttp
|
||||||
|
|
@ -7,6 +7,8 @@ from PySide.QtCore import QUrl, QFileInfo, QFile, QIODevice
|
||||||
from zipfile import ZipFile
|
from zipfile import ZipFile
|
||||||
from tarfile import TarFile
|
from tarfile import TarFile
|
||||||
|
|
||||||
|
|
||||||
|
#if this is a mac application
|
||||||
frozen = getattr(sys, 'frozen', '')
|
frozen = getattr(sys, 'frozen', '')
|
||||||
|
|
||||||
if frozen:
|
if frozen:
|
||||||
|
|
@ -15,6 +17,12 @@ if frozen:
|
||||||
else:
|
else:
|
||||||
CWD = os.getcwd()
|
CWD = os.getcwd()
|
||||||
|
|
||||||
|
if platform.system() == 'Windows':
|
||||||
|
TEMP_DIR = os.path.join('c:/','windows','temp')
|
||||||
|
else:
|
||||||
|
TEMP_DIR = os.path.sep+'tmp'
|
||||||
|
|
||||||
|
|
||||||
class WThread(QtCore.QThread):
|
class WThread(QtCore.QThread):
|
||||||
def __init__(self, widget, method_name, parent=None):
|
def __init__(self, widget, method_name, parent=None):
|
||||||
QtCore.QThread.__init__(self, parent)
|
QtCore.QThread.__init__(self, parent)
|
||||||
|
|
@ -42,7 +50,7 @@ class Setting(object):
|
||||||
if self.value is None:
|
if self.value is None:
|
||||||
self.value = self.default_value
|
self.value = self.default_value
|
||||||
|
|
||||||
self.save_path = kwargs.pop('save_path', os.path.sep+'tmp')
|
self.save_path = kwargs.pop('save_path', TEMP_DIR)
|
||||||
|
|
||||||
if hasattr(self, 'url'):
|
if hasattr(self, 'url'):
|
||||||
self.file_name = self.url.split('/')[-1]
|
self.file_name = self.url.split('/')[-1]
|
||||||
|
|
@ -764,7 +772,7 @@ class MainWindow(QtGui.QWidget):
|
||||||
self.progress_label.setText('Removing old output directory...')
|
self.progress_label.setText('Removing old output directory...')
|
||||||
|
|
||||||
outputDir = os.path.join(self.outputDir(), self.projectName())
|
outputDir = os.path.join(self.outputDir(), self.projectName())
|
||||||
tempDir = os.path.join(os.path.sep+'tmp', 'webexectemp')
|
tempDir = os.path.join(TEMP_DIR, 'webexectemp')
|
||||||
if os.path.exists(tempDir):
|
if os.path.exists(tempDir):
|
||||||
shutil.rmtree(tempDir)
|
shutil.rmtree(tempDir)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue