[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnuastro-commits] master 2378a95: Match output names keep directory of

From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 2378a95: Match output names keep directory of given output
Date: Mon, 26 Feb 2018 11:54:43 -0500 (EST)

branch: master
commit 2378a95bc746a775c010402181b94a780991ba0c
Author: Mohammad Akhlaghi <address@hidden>
Commit: Mohammad Akhlaghi <address@hidden>

    Match output names keep directory of given output
    Until now, when Match was asked to make two files with a given output
    filename, it will ignore the directory of the output.
    This is because it uses the standard `gal_checkset_automatic_output'
    function which is designed for making an output filenames from THE INPUT
    filename. Therefore, as described in Automatic output, it will ignore the
    directory of the input's name by default.
    However, Match can have two output file names (when the output is requested
    to be a text file). In such cases, it also uses
    `gal_checkset_automatic_output' to generate the (new) output file names
    from the single output name given to it, which caused the problem above.
    To fix the issue, when the output file name is used to define the new
    output names, Match now temporarily sets `p->cp.keepinputdir' to 1.
    This fixes bug #53226.
 NEWS           |  2 ++
 bin/match/ui.c | 13 +++++++++++++
 2 files changed, 15 insertions(+)

diff --git a/NEWS b/NEWS
index abccbc8..f8a8585 100644
--- a/NEWS
+++ b/NEWS
@@ -26,6 +26,8 @@ GNU Astronomy Utilities NEWS                          -*- 
outline -*-
   NULL value of onlyversion option causing a crash (bug #53147).
+  Match output directory ignored when making multiple files (bug #53226).
diff --git a/bin/match/ui.c b/bin/match/ui.c
index a1cf2af..69691af 100644
--- a/bin/match/ui.c
+++ b/bin/match/ui.c
@@ -564,6 +564,10 @@ ui_preparations_out_cols(struct matchparams *p)
 static void
 ui_preparations_out_name(struct matchparams *p)
+  /* To temporarily keep the original value. */
+  uint8_t keepinputdir_orig;
+  /* Set the output file(s) name(s). */
       /* Set the logname (as output). */
@@ -604,12 +608,21 @@ ui_preparations_out_name(struct matchparams *p)
+                  /* Here, we are be using the output name as input to the
+                     automatic output generating function (usually it is
+                     the input name, not the output name). Therefore, the
+                     `keepinputdir' variable should be 1. So we will
+                     temporarily change it here, then set it back to what
+                     it was. */
+                  keepinputdir_orig=p->cp.keepinputdir;
+                  p->cp.keepinputdir=1;
+                  p->cp.keepinputdir=keepinputdir_orig;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]