Browse Source

UI: Proper unsetenv is needed for Windows

tags/1.9.5
falkTX 10 years ago
parent
commit
7bc5889737
3 changed files with 35 additions and 3 deletions
  1. +10
    -0
      source/carla_backend.py
  2. +2
    -3
      source/carla_database.py
  3. +23
    -0
      source/modules/native-plugins/resources/carla-plugin

+ 10
- 0
source/carla_backend.py View File

@@ -1751,6 +1751,14 @@ class Host(object):
keyvalue = "%s=%s" % (key, value) keyvalue = "%s=%s" % (key, value)
self.msvcrt._putenv(keyvalue.encode("utf-8")) 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): def _init(self, libName):
self.lib = cdll.LoadLibrary(libName) self.lib = cdll.LoadLibrary(libName)


@@ -2022,3 +2030,5 @@ class Host(object):
self.msvcrt = cdll.msvcrt self.msvcrt = cdll.msvcrt
self.msvcrt._putenv.argtypes = [c_char_p] self.msvcrt._putenv.argtypes = [c_char_p]
self.msvcrt._putenv.restype = None self.msvcrt._putenv.restype = None
else:
self.msvcrt = None

+ 2
- 3
source/carla_database.py View File

@@ -1132,10 +1132,9 @@ class PluginRefreshW(QDialog):
self.ui.group_options.setEnabled(False) self.ui.group_options.setEnabled(False)


if self.ui.ch_do_checks.isChecked(): 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: 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(), native, posix32, posix64, win32, win64 = (self.ui.ch_native.isChecked(),
self.ui.ch_posix32.isChecked(), self.ui.ch_posix64.isChecked(), self.ui.ch_posix32.isChecked(), self.ui.ch_posix64.isChecked(),


+ 23
- 0
source/modules/native-plugins/resources/carla-plugin View File

@@ -62,6 +62,13 @@ class PluginHost(object):


self.fPluginsInfo = [] 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): def _add(self, pluginId):
if len(self.fPluginsInfo) != pluginId: if len(self.fPluginsInfo) != pluginId:
return return
@@ -513,6 +520,22 @@ class PluginHost(object):
def get_host_osc_url_udp(self): def get_host_osc_url_udp(self):
return "" 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 # Main Window




Loading…
Cancel
Save