From a4fc4dc00b59705b380d65b1cc8e486ac607d88c Mon Sep 17 00:00:00 2001 From: Richard Harrison Date: Sun, 31 May 2026 17:45:37 +0200 Subject: [PATCH 1/2] Do not prepend the output path to an already-absolute output name FGOutputFile::SetOutputName always joins the configured output path with the supplied name, which produces a malformed path when the name is itself absolute. Take an absolute name as-is; only relative names are resolved under the output path. --- src/input_output/FGOutputFile.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/input_output/FGOutputFile.h b/src/input_output/FGOutputFile.h index ddfffb1cee..849bcfa60f 100644 --- a/src/input_output/FGOutputFile.h +++ b/src/input_output/FGOutputFile.h @@ -100,7 +100,10 @@ class FGOutputFile : public FGOutputType the next call to SetStartNewOutput(). @param name new name */ void SetOutputName(const std::string& fname) override { - Name = (FDMExec->GetOutputPath()/fname).utf8Str(); + // An absolute name is used as-is; only a relative name is taken under the + // output path. + SGPath p(fname); + Name = p.isAbsolute() ? fname : (FDMExec->GetOutputPath()/fname).utf8Str(); runID_postfix = -1; Filename = SGPath(); } From c083df8770c6520827743deff386375b1da288bb Mon Sep 17 00:00:00 2001 From: Richard Harrison Date: Mon, 22 Jun 2026 23:01:44 +0100 Subject: [PATCH 2/2] Refs #1475 : Document SetOutputName relative and absolute path handling The rule for relative and absolute output names was only an inline comment in the method body. Move it into the method's Doxygen so the path-handling contract appears in the generated API documentation. Also correct the documented parameter name from name to fname. --- src/input_output/FGOutputFile.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/input_output/FGOutputFile.h b/src/input_output/FGOutputFile.h index 849bcfa60f..6ad51a3c6b 100644 --- a/src/input_output/FGOutputFile.h +++ b/src/input_output/FGOutputFile.h @@ -95,13 +95,13 @@ class FGOutputFile : public FGOutputType */ void SetStartNewOutput(void) override; /** Overwrites the name identifier under which the output will be logged. + If fname is a relative filepath then prepend the configured output path, + otherwise use the absolute filepath. For this method to take effect, it must be called prior to FGFDMExec::RunIC(). If it is called after, it will not take effect before the next call to SetStartNewOutput(). - @param name new name */ + @param fname new name */ void SetOutputName(const std::string& fname) override { - // An absolute name is used as-is; only a relative name is taken under the - // output path. SGPath p(fname); Name = p.isAbsolute() ? fname : (FDMExec->GetOutputPath()/fname).utf8Str(); runID_postfix = -1;