Revision: 77995
          http://sourceforge.net/p/brlcad/code/77995
Author:   starseeker
Date:     2020-12-17 21:41:11 +0000 (Thu, 17 Dec 2020)
Log Message:
-----------
If an existing .g file is supplied to gcv, rather than quitting append to it.  
This involves changing libgcv's logic to append to rather than replacing an 
existing .g file.

Modified Paths:
--------------
    brlcad/trunk/NEWS
    brlcad/trunk/TODO
    brlcad/trunk/src/conv/gcv/gcv.c
    brlcad/trunk/src/libgcv/gcv.c

Modified: brlcad/trunk/NEWS
===================================================================
--- brlcad/trunk/NEWS   2020-12-17 21:10:30 UTC (rev 77994)
+++ brlcad/trunk/NEWS   2020-12-17 21:41:11 UTC (rev 77995)
@@ -13,6 +13,7 @@
 --- 2020-xx-xx  Release 7.32.2                                     ---
 ----------------------------------------------------------------------
 
+* changed gcv converter to append to existing .g files - Cliff Yapp
 * added a '-f' forcing option to MGED's quit command - Cliff Yapp
 * changed MGED's quit command to wait for subprocesses - Cliff Yapp
 * removed obscure MGED menu entries for unused features - Cliff Yapp

Modified: brlcad/trunk/TODO
===================================================================
--- brlcad/trunk/TODO   2020-12-17 21:10:30 UTC (rev 77994)
+++ brlcad/trunk/TODO   2020-12-17 21:41:11 UTC (rev 77995)
@@ -41,9 +41,6 @@
   contexts, allowing for more than one timer to be active.  Make sure
   the old librt API can be obsoleted cleanly.
 
-* libgcv should add objects to an existing .g if one is specified
-  as the output target - right now it's overwriting the old file
-
 * f_dbopen in MGED doesn't seem to be reporting failure
   if a non-.g file is fed to opendb.  That doesn't seem
   right... shouldn't the open process completely fail

Modified: brlcad/trunk/src/conv/gcv/gcv.c
===================================================================
--- brlcad/trunk/src/conv/gcv/gcv.c     2020-12-17 21:10:30 UTC (rev 77994)
+++ brlcad/trunk/src/conv/gcv/gcv.c     2020-12-17 21:41:11 UTC (rev 77995)
@@ -357,9 +357,8 @@
 
     if (bu_file_exists(argv[0], NULL)) {
        if (msg) {
-           bu_vls_sprintf(msg, "Error - file %s already exists!\n", argv[0]);
+           bu_vls_sprintf(msg, "Note - file %s already exists, appending 
conversion output\n", argv[0]);
        }
-       return -1;
     }
 
     if (file_set)

Modified: brlcad/trunk/src/libgcv/gcv.c
===================================================================
--- brlcad/trunk/src/libgcv/gcv.c       2020-12-17 21:10:30 UTC (rev 77994)
+++ brlcad/trunk/src/libgcv/gcv.c       2020-12-17 21:41:11 UTC (rev 77995)
@@ -87,7 +87,13 @@
                  const struct gcv_opts *UNUSED(gcv_options), const void 
*UNUSED(options_data),
                  const char *dest_path)
 {
-    struct rt_wdb * const out_wdbp = wdb_fopen(dest_path);
+    struct rt_wdb * out_wdbp = NULL;
+    if (!bu_file_exists(dest_path, NULL)) {
+       out_wdbp = wdb_fopen(dest_path);
+    } else {
+       struct db_i *dbip = db_open(dest_path, DB_OPEN_READWRITE);
+       out_wdbp = wdb_dbopen(dbip, RT_WDB_TYPE_DB_DISK_APPEND_ONLY);
+    }
 
     if (!out_wdbp) {
        bu_log("wdb_fopen() failed for '%s'\n", dest_path);

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to