From 7d63920f25b0e5e7d23b820fba7773385a197719 Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Thu, 15 Oct 2015 14:41:49 -0400 Subject: [PATCH] srcparser.py split mixed windows path with os.path.split -fixes #2997 --- Tools/px4airframes/rcout.py | 3 ++- Tools/px4airframes/srcparser.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Tools/px4airframes/rcout.py b/Tools/px4airframes/rcout.py index de5af0f305..48bb1774a9 100644 --- a/Tools/px4airframes/rcout.py +++ b/Tools/px4airframes/rcout.py @@ -1,5 +1,6 @@ from xml.sax.saxutils import escape import codecs +import os class RCOutput(): def __init__(self, groups, board): @@ -30,7 +31,7 @@ class RCOutput(): for group in groups: result += "# GROUP: %s\n\n" % group.GetName() for param in group.GetParams(): - path = param.GetPath().rsplit('/', 1)[1] + path = os.path.split(param.GetPath())[1] id_val = param.GetId() name = param.GetFieldValue("short_desc") long_desc = param.GetFieldValue("long_desc") diff --git a/Tools/px4airframes/srcparser.py b/Tools/px4airframes/srcparser.py index fb491ede15..e1d522dcd8 100644 --- a/Tools/px4airframes/srcparser.py +++ b/Tools/px4airframes/srcparser.py @@ -1,5 +1,6 @@ import sys import re +import os class ParameterGroup(object): """ @@ -160,7 +161,7 @@ class SourceParser(object): """ airframe_id = None - airframe_id = path.rsplit('/',1)[1].split('_',1)[0] + airframe_id = os.path.split(path)[1].split('_',1)[0] # Skip if not numeric if (not self.IsNumber(airframe_id)):