gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master 5dbbeca 2/2: Arithmetic: checking existing out


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 5dbbeca 2/2: Arithmetic: checking existing output name, also when no .fits suffix
Date: Mon, 29 Nov 2021 08:25:57 -0500 (EST)

branch: master
commit 5dbbecaf24391a2ab13892cc83006c4dac703822
Author: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>

    Arithmetic: checking existing output name, also when no .fits suffix
    
    Until now, when an output name was given, but the input file name didn't
    have a '.fits' suffix, Arithmetic would not delete the output file (to
    write from scratch), it would simply add a new extension to the already
    existing file.
    
    With this commit, a check has been added to check the contents of a file
    also and remove the output file if it already existed.
    
    This fixes bug #61584.
---
 NEWS                | 3 +++
 bin/arithmetic/ui.c | 3 ++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index bfc2233..fb93c82 100644
--- a/NEWS
+++ b/NEWS
@@ -108,6 +108,9 @@ See the end of the file for license conditions.
               tables, found by Zohre Ghaffari.
   bug #61493: NoiseChisel's --checksn not showing pseudos equal to
               --snminarea (only larger ones), found by Raúl Infante-Sainz.
+  bug #61584: When FITS file doesn't end with '.fits' and the output file
+              already existed, Arithmetic would write the output in new
+              extension while it should have been deleted.
 
 
 
diff --git a/bin/arithmetic/ui.c b/bin/arithmetic/ui.c
index 35f4b82..6a8bc03 100644
--- a/bin/arithmetic/ui.c
+++ b/bin/arithmetic/ui.c
@@ -296,7 +296,8 @@ ui_check_options_and_arguments(struct arithmeticparams *p)
           /* This token is a file, count how many mult-extension files we
              have and use the first to set the output filename (if it has
              not been set). */
-          if( gal_array_name_recognized(token->v) )
+          if( gal_array_name_recognized(token->v)
+              || gal_fits_file_recognized(token->v) )
             {
               /* Increment the counter for FITS files (if they are
                  input). Recall that the 'tofile' operator can also have



reply via email to

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