[ovs-dev] [PATCH V9 10/17] python tests: Fixed abs_file_name function for Windows

Paul Boca pboca at cloudbasesolutions.com
Tue Jul 26 12:01:11 UTC 2016


On windows a path containint ':' is considered an absolute path.

Signed-off-by: Paul-Daniel Boca <pboca at cloudbasesolutions.com>
Acked-by: Alin Gabriel Serdean <aserdean at cloudbasesolutions.com>
---
V2: No changes
V3: No changes
V4: No changes
V5: No changes
V6: No changes
V7: No changes
V8: No changes
V9: No changes
---
 python/ovs/util.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/python/ovs/util.py b/python/ovs/util.py
index cb0574b..411ac99 100644
--- a/python/ovs/util.py
+++ b/python/ovs/util.py
@@ -29,8 +29,10 @@ def abs_file_name(dir_, file_name):
     Returns None if 'dir_' is None and getcwd() fails.
 
     This differs from os.path.abspath() in that it will never change the
-    meaning of a file name."""
-    if file_name.startswith('/'):
+    meaning of a file name.
+
+    On Windows an absolute path contains ':' ( i.e: C:\ ) """
+    if file_name.startswith('/') or file_name.find(':') > -1:
         return file_name
     else:
         if dir_ is None or dir_ == "":
-- 
2.7.2.windows.1



More information about the dev mailing list