diff --git a/bin/platformio-custom.py b/bin/platformio-custom.py index b0749ea26..bb8a53b50 100644 --- a/bin/platformio-custom.py +++ b/bin/platformio-custom.py @@ -2,14 +2,20 @@ Import("projenv") import configparser -config = configparser.RawConfigParser() -config.read(projenv["PROJECT_DIR"] + "/version.properties") -version = dict(config.items('VERSION')) -verStr = "{}.{}.{}".format(version["major"], version["minor"], version["build"]) +prefsLoc = projenv["PROJECT_DIR"] + "/version.properties" +print(f"Preferences in {prefsLoc}") +try: + config = configparser.RawConfigParser() + config.read(prefsLoc) + version = dict(config.items('VERSION')) + verStr = "{}.{}.{}".format(version["major"], version["minor"], version["build"]) +except: + print("Can't read preferences, using 0.0.0") + verStr = "0.0.0" print(f"Using meshtastic platform-custom.py, firmare version {verStr}") # General options that are passed to the C and C++ compilers projenv.Append(CCFLAGS=[ f"-DAPP_VERSION={verStr}" - ]) \ No newline at end of file + ])