diff --git a/tagstudio/src/qt/ts_qt.py b/tagstudio/src/qt/ts_qt.py index eb029248..7064223c 100644 --- a/tagstudio/src/qt/ts_qt.py +++ b/tagstudio/src/qt/ts_qt.py @@ -107,9 +107,6 @@ INFO = f"[INFO]" logging.basicConfig(format="%(message)s", level=logging.INFO) -# Keep settings in ini format in the current working directory. -QSettings.setPath(QSettings.IniFormat, QSettings.UserScope, os.getcwd()) - class NavigationState: """Represents a state of the Library grid view.""" @@ -189,9 +186,21 @@ class QtDriver(QObject): self.SIGTERM.connect(self.handleSIGTERM) - self.settings = QSettings( - QSettings.IniFormat, QSettings.UserScope, "tagstudio", "TagStudio" - ) + if self.args.config_file: + path = Path(self.args.config_file) + if not path.exists(): + logging.warning( + f"[QT DRIVER] Config File does not exist creating {str(path)}" + ) + logging.info(f"[QT DRIVER] Using Config File {str(path)}") + self.settings = QSettings(str(path), QSettings.IniFormat) + else: + self.settings = QSettings( + QSettings.IniFormat, QSettings.UserScope, "TagStudio", "TagStudio" + ) + logging.info( + f"[QT DRIVER] Config File not specified, defaulting to {self.settings.fileName()}" + ) max_threads = os.cpu_count() if args.ci: diff --git a/tagstudio/tag_studio.py b/tagstudio/tag_studio.py index 92440160..b80f2e01 100644 --- a/tagstudio/tag_studio.py +++ b/tagstudio/tag_studio.py @@ -29,6 +29,14 @@ def main(): type=str, help="Path to a TagStudio Library folder to open on start.", ) + parser.add_argument( + "-c", + "--config-file", + dest="config_file", + type=str, + help="Path to a TagStudio.ini config file to use", + ) + # parser.add_argument('--browse', dest='browse', action='store_true', # help='Jumps to entry browsing on startup.') # parser.add_argument('--external_preview', dest='external_preview', action='store_true',