diff --git a/PyMultibound/common.py b/PyMultibound/common.py index 42e9cc9..47c81d4 100644 --- a/PyMultibound/common.py +++ b/PyMultibound/common.py @@ -2,18 +2,6 @@ from paths import * -logging.basicConfig( - format="%(asctime)s: %(levelname)s - %(module)s - %(funcName)s: %(message)s", - level=logging.DEBUG, - filename=join(os.path.dirname(os.path.realpath(__file__)), "PyMultibound.log"), - filemode="w" -) - -VERSION = "v1.0.1" - -logging.info(f"PyMultibound Version: {VERSION}, Platform: {platform.system()}") - - def safe_move(src, dst): """ Attempt to move a directory or file using shutil.move() @@ -24,7 +12,7 @@ def safe_move(src, dst): shutil.move(src, dst) return True except Exception as e: - logging.error(f"An error occured while trying to move {src} to {dst}: {e}") + logging.error(f"An error occurred while trying to move {src} to {dst}: {e}") return False @@ -32,7 +20,7 @@ def runStarbound(profile: str): """ Run Starbound with the given profile """ - logging.info("Starting starbound...") + logging.info("Starting Starbound...") cmd = f'"{paths["starboundExecutable"]}" ' \ f'-bootconfig "{join(paths["profiles"], profile, "sbinit.config")}"' logging.info(f"Launch command: {cmd}") diff --git a/PyMultibound/config.py b/PyMultibound/config.py new file mode 100644 index 0000000..16d0579 --- /dev/null +++ b/PyMultibound/config.py @@ -0,0 +1,13 @@ +import logging, os, platform + +# This is imported into paths.py, and is therefore the first thing ran on startup + +logging.basicConfig( + format="%(asctime)s: %(levelname)s - %(module)s - %(funcName)s: %(message)s", + level=logging.DEBUG, + filename=os.path.join(os.path.dirname(os.path.realpath(__file__)), "PyMultibound.log"), + filemode="w" +) + +VERSION = "v1.0.1" +logging.info(f"PyMultibound Version: {VERSION}, Platform: {platform.system()}") \ No newline at end of file diff --git a/PyMultibound/paths.py b/PyMultibound/paths.py index 8be1c38..92982dd 100644 --- a/PyMultibound/paths.py +++ b/PyMultibound/paths.py @@ -1,5 +1,7 @@ import logging, os, platform, sys, json from os.path import join +from config import *# Just sets up logging + # About the two sbinits: # When I switched to Linux I noticed the sbinit.config looked different. @@ -96,7 +98,6 @@ def savePaths(paths: {}): with open(settings, "r") as f: paths = json.load(f) logging.info("Loaded settings from file") -logging.info(f"Paths: {paths}") if not os.path.exists(paths["profiles"]): os.mkdir(paths["profiles"]) @@ -104,3 +105,5 @@ def savePaths(paths: {}): if not os.path.exists(paths["templates"]): os.mkdir(paths["templates"]) logging.info("Created templates directory") + +logging.info(f"Paths: {paths}")