Salome HOME
petit correctif suite à discussion
[tools/sat.git] / src / environment.py
index ae27354a8767b79918c540adab38f0f4abaf6b9c..08565ce752ec4004fe10c411278e0fb9aee0d578 100644 (file)
@@ -73,18 +73,11 @@ class Environ:
         :param value str: the value to append to key
         :param sep str: the separator string
         """
-        if src.architecture.is_windows():
-          separators = [';']
-        else:
-          separators = [':']
-        for c in separators: # windows or linux path separators
-          isOK = True
-          if c in value and not src.architecture.is_windows():
-            isOK = False
-          elif c in value and src.architecture.is_windows() and value.count(':') > 1:
-            isOK = False
-          if not isOK:
-            raise Exception("Environ append key '%s' value '%s' contains forbidden character '%s'" % (key, value, c))
+        # check that value so no contain the system separator
+        separator=os.pathsep
+        if separator in value:
+            raise Exception("Environ append key '%s' value '%s' contains forbidden character '%s'" % (key, value, separator))
+
         # check if the key is already in the environment
         if key in self.environ:
             value_list = self.environ[key].split(sep)
@@ -120,18 +113,11 @@ class Environ:
         :param value str: the value to prepend to key
         :param sep str: the separator string
         """
-        if src.architecture.is_windows():
-          separators = [';']
-        else:
-          separators = [':']
-        for c in separators: # windows or linux path separators
-          isOK = True
-          if c in value and not src.architecture.is_windows():
-            isOK = False
-          elif c in value and src.architecture.is_windows() and value.count(':') > 1:
-            isOK = False
-          if not isOK:
-            raise Exception("Environ prepend key '%s' value '%s' contains forbidden character '%s'" % (key, value, c))
+        # check that value so no contain the system separator
+        separator=os.pathsep
+        if separator in value:
+            raise Exception("Environ append key '%s' value '%s' contains forbidden character '%s'" % (key, value, separator))
+
         # check if the key is already in the environment
         if key in self.environ:
             value_list = self.environ[key].split(sep)