From f480d65e0319662d735b84ffc4768868694c8ec6 Mon Sep 17 00:00:00 2001 From: Stefan Sayer Date: Wed, 8 Sep 2010 18:51:08 +0200 Subject: [PATCH] DSM: fix #include path for recursive #include if in absolute path, script path will be the path of the included script --- apps/dsm/DSMStateDiagramCollection.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/apps/dsm/DSMStateDiagramCollection.cpp b/apps/dsm/DSMStateDiagramCollection.cpp index 07f991db..cc75806e 100644 --- a/apps/dsm/DSMStateDiagramCollection.cpp +++ b/apps/dsm/DSMStateDiagramCollection.cpp @@ -66,8 +66,17 @@ bool DSMStateDiagramCollection::readFile(const string& filename, const string& n return false; } - string include_name = r[0]=='/' ? r : load_path+"/"+r; - if (!readFile(include_name, name, load_path, s)) + string current_load_path; + string include_name; + if (r[0]=='/') { + include_name = r; + size_t ppos = r.rfind("/"); + current_load_path = r.substr(0, ppos) + "/"; + } else { + current_load_path = load_path; + include_name = load_path+"/"+r; + } + if (!readFile(include_name, name, current_load_path, s)) return false; continue; }