diff --git a/source/carla_backend.py b/source/carla_backend.py index ee9261891..7f9a9d8aa 100644 --- a/source/carla_backend.py +++ b/source/carla_backend.py @@ -1751,6 +1751,14 @@ class Host(object): keyvalue = "%s=%s" % (key, value) self.msvcrt._putenv(keyvalue.encode("utf-8")) + # extra + def unsetenv(self, key): + environ.pop(key) + + if WINDOWS: + keyrm = "%s=" % key + self.msvcrt._putenv(keyrm.encode("utf-8")) + def _init(self, libName): self.lib = cdll.LoadLibrary(libName) @@ -2022,3 +2030,5 @@ class Host(object): self.msvcrt = cdll.msvcrt self.msvcrt._putenv.argtypes = [c_char_p] self.msvcrt._putenv.restype = None + else: + self.msvcrt = None diff --git a/source/carla_database.py b/source/carla_database.py index 03591e61d..ca3efd18f 100755 --- a/source/carla_database.py +++ b/source/carla_database.py @@ -1132,10 +1132,9 @@ class PluginRefreshW(QDialog): self.ui.group_options.setEnabled(False) if self.ui.ch_do_checks.isChecked(): - if os.getenv("CARLA_DISCOVERY_NO_PROCESSING_CHECKS") is not None: - os.environ.pop("CARLA_DISCOVERY_NO_PROCESSING_CHECKS") + gCarla.host.unsetenv("CARLA_DISCOVERY_NO_PROCESSING_CHECKS") else: - os.environ["CARLA_DISCOVERY_NO_PROCESSING_CHECKS"] = "true" + gCarla.host.setenv("CARLA_DISCOVERY_NO_PROCESSING_CHECKS", "true") native, posix32, posix64, win32, win64 = (self.ui.ch_native.isChecked(), self.ui.ch_posix32.isChecked(), self.ui.ch_posix64.isChecked(), diff --git a/source/modules/native-plugins/resources/carla-plugin b/source/modules/native-plugins/resources/carla-plugin index 9ac202807..059c2a14f 100755 --- a/source/modules/native-plugins/resources/carla-plugin +++ b/source/modules/native-plugins/resources/carla-plugin @@ -62,6 +62,13 @@ class PluginHost(object): self.fPluginsInfo = [] + if WINDOWS: + self.msvcrt = cdll.msvcrt + self.msvcrt._putenv.argtypes = [c_char_p] + self.msvcrt._putenv.restype = None + else: + self.msvcrt = None + def _add(self, pluginId): if len(self.fPluginsInfo) != pluginId: return @@ -513,6 +520,22 @@ class PluginHost(object): def get_host_osc_url_udp(self): return "" + # extra + def setenv(self, key, value): + environ[key] = value + + if WINDOWS: + keyvalue = "%s=%s" % (key, value) + self.msvcrt._putenv(keyvalue.encode("utf-8")) + + # extra + def unsetenv(self, key): + environ.pop(key) + + if WINDOWS: + keyrm = "%s=" % key + self.msvcrt._putenv(keyrm.encode("utf-8")) + # ------------------------------------------------------------------------------------------------------------ # Main Window