Block cluttering of the user's home folder

This commit is contained in:
Veronica K. B. Olsen
2020-10-04 16:38:53 +02:00
parent eaf8e83d40
commit 2cc12490d8
3 changed files with 11 additions and 8 deletions
+2 -4
View File
@@ -68,7 +68,6 @@ class Config:
self.confPath = None # Folder where the config is saved
self.confFile = None # The config file name
self.dataPath = None # Folder where app data is stored
self.homePath = None # The user's home folder
self.lastPath = None # The last user-selected folder (browse dialogs)
self.appPath = None # The full path to the novelwriter package folder
self.appRoot = None # The full path to the novelwriter root folder
@@ -257,8 +256,7 @@ class Config:
logger.verbose("Data path: %s" % self.dataPath)
self.confFile = self.appHandle+".conf"
self.homePath = os.path.expanduser("~")
self.lastPath = self.homePath
self.lastPath = os.path.expanduser("~")
self.appPath = getattr(sys, "_MEIPASS", os.path.abspath(os.path.dirname(__file__)))
self.appRoot = os.path.join(self.appPath, os.path.pardir)
self.assetPath = os.path.join(self.appPath, "assets")
@@ -268,7 +266,7 @@ class Config:
self.appIcon = os.path.join(self.iconPath, "novelwriter.svg")
logger.verbose("App path: %s" % self.appPath)
logger.verbose("Home path: %s" % self.homePath)
logger.verbose("Last path: %s" % self.lastPath)
# If config folder does not exist, make it.
# This assumes that the os config folder itself exists.
+4
View File
@@ -757,6 +757,10 @@ class NWProject():
if self.projPath is None or self.projPath == "":
return False
if self.projPath == os.path.expanduser("~"):
# Don't make a mess in the user's home folder
return False
self.projMeta = os.path.join(self.projPath, "meta")
self.projCache = os.path.join(self.projPath, "cache")
self.projContent = os.path.join(self.projPath, "content")
+5 -4
View File
@@ -320,11 +320,12 @@ class GuiWritingStats(QDialog):
# Generate the file name
if fileExt:
fileName = "sessionStats.%s" % fileExt
saveDir = self.mainConf.lastPath
savePath = os.path.join(saveDir, fileName)
saveDir = self.mainConf.lastPath
if not os.path.isdir(saveDir):
saveDir = self.mainConf.homePath
saveDir = os.path.expanduser("~")
fileName = "sessionStats.%s" % fileExt
savePath = os.path.join(saveDir, fileName)
dlgOpt = QFileDialog.Options()
dlgOpt |= QFileDialog.DontUseNativeDialog