diff options
Diffstat (limited to 'xsd/cxx/tree/generator.cxx')
-rw-r--r-- | xsd/cxx/tree/generator.cxx | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/xsd/cxx/tree/generator.cxx b/xsd/cxx/tree/generator.cxx index ae86767..c13bf1f 100644 --- a/xsd/cxx/tree/generator.cxx +++ b/xsd/cxx/tree/generator.cxx @@ -834,6 +834,7 @@ namespace CXX generate (Tree::CLI::Options const& ops, Schema& schema, Path const& file_path, + Boolean fpt, StringLiteralMap const& string_literal_map, const WarningSet& disabled_warnings, FileList& file_list, @@ -1048,19 +1049,13 @@ namespace CXX Path (cxx_expr.merge (name), boost::filesystem::native)); } - if (NarrowString dir = ops.value<CLI::output_dir> ()) + Path out_dir; + + if (NarrowString dir = ops.value<CLI::output_dir> ()) { try { - Path path (dir, boost::filesystem::native); - - hxx_path = path / hxx_path; - ixx_path = path / ixx_path; - fwd_path = path / fwd_path; - - for (Paths::Iterator i (cxx_paths.begin ()); - i != cxx_paths.end (); ++i) - *i = path / *i; + out_dir = Path (dir, boost::filesystem::native); } catch (InvalidPath const&) { @@ -1069,6 +1064,29 @@ namespace CXX } } + if (fpt && !generate_xml_schema) + { + // In the file-per-type mode the schema files are always local + // unless the user added the directory so that we propagate this + // to the output files. + // + Path fpt_dir (file_path.branch_path ()); + + if (!fpt_dir.empty ()) + out_dir /= fpt_dir; + } + + if (!out_dir.empty ()) + { + hxx_path = out_dir / hxx_path; + ixx_path = out_dir / ixx_path; + fwd_path = out_dir / fwd_path; + + for (Paths::Iterator i (cxx_paths.begin ()); + i != cxx_paths.end (); ++i) + *i = out_dir / *i; + } + // // WideOutputFileStream hxx (hxx_path, ios_base::out); |