From 973bf320742fd4919c09f68c3918f5a0037cfe7b Mon Sep 17 00:00:00 2001
From: Bertrand Coconnier <bcoconni@users.sourceforge.net>
Date: Sat, 25 Jan 2020 16:05:30 +0100
Subject: [PATCH] [JSBSim] Added the ability to log properties in a CSV file.

---
 src/FDM/JSBSim/JSBSim.cxx | 4 ++++
 src/Main/options.cxx      | 1 +
 2 files changed, 5 insertions(+)

diff --git a/src/FDM/JSBSim/JSBSim.cxx b/src/FDM/JSBSim/JSBSim.cxx
index dd6869d34..5a9fcf92e 100644
--- a/src/FDM/JSBSim/JSBSim.cxx
+++ b/src/FDM/JSBSim/JSBSim.cxx
@@ -389,6 +389,10 @@ FGJSBsim::FGJSBsim( double dt )
     FGTrim *fgtrim = new FGTrim(fdmex,tFull);
     fgtrim->DoTrim();
     delete fgtrim;
+
+    string directive_file = fgGetString("/sim/jsbsim/output-directive-file");
+    if (!directive_file.empty())
+      fdmex->SetOutputDirectives(directive_file);
 }
 
 /******************************************************************************/
diff --git a/src/Main/options.cxx b/src/Main/options.cxx
index 147659aca..c93ec85fe 100644
--- a/src/Main/options.cxx
+++ b/src/Main/options.cxx
@@ -1846,6 +1846,7 @@ struct OptionDesc {
     {"prop",                         true,  OPTION_FUNC | OPTION_MULTI,   "", false, "", fgOptSetProperty},
     {"load-tape",                    true,  OPTION_FUNC,   "", false, "", fgOptLoadTape },
     {"developer",                    true,  OPTION_IGNORE | OPTION_BOOL, "", false, "", nullptr },
+    {"jsbsim-output-directive-file", true,  OPTION_STRING, "/sim/jsbsim/output-directive-file", false, "", nullptr },
     {0}
 };