From 89fb0b58d9d103db11b7e18286dccd9825fd7754 Mon Sep 17 00:00:00 2001 From: tradke Date: Thu, 5 Apr 2001 21:05:55 +0000 Subject: Omit the dotslash in advertised output filenames if output goes into current directory. git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/IOBasic/trunk@87 b589c3ab-70e8-4b4d-a09f-cba2dd200880 --- src/Write.c | 10 +++++++++- src/WriteGF.c | 24 ++++++++++++++++++++---- 2 files changed, 29 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/Write.c b/src/Write.c index 6eb155a..5ae5bb4 100644 --- a/src/Write.c +++ b/src/Write.c @@ -65,8 +65,16 @@ void IOBasic_Write (cGH *GH, int vindex, const char *alias) myGH = (iobasicGH *) GH->extensions [CCTK_GHExtensionHandle ("IOBasic")]; /* build the output filename */ + /* skip the pathname if output goes into current directory */ fname = (char *) malloc (strlen (myGH->outdirScalar) + strlen (alias) + 5); - sprintf (fname, "%s/%s.tl", myGH->outdirScalar, alias); + if (strcmp (myGH->outdirScalar, ".")) + { + sprintf (fname, "%s/%s.tl", myGH->outdirScalar, alias); + } + else + { + sprintf (fname, "%s.tl", alias); + } /* see if output files for this alias name were already created */ if (GetNamedData (myGH->filenameListScalar, fname) == NULL) diff --git a/src/WriteGF.c b/src/WriteGF.c index d5c7d18..71f7b05 100644 --- a/src/WriteGF.c +++ b/src/WriteGF.c @@ -168,8 +168,16 @@ void IOBasic_WriteGF (cGH *GH, /* build the filename */ if (new_filename_scheme) { - sprintf (filename, "%s/%s_%s%s", myGH->outdirScalar, alias, - reduction_op, file_extension); + /* skip the pathname if output goes into current directory */ + if (strcmp (myGH->outdirScalar, ".")) + { + sprintf (filename, "%s/%s_%s%s", myGH->outdirScalar, alias, + reduction_op, file_extension); + } + else + { + sprintf (filename, "%s_%s%s", alias, reduction_op, file_extension); + } } else { @@ -194,8 +202,16 @@ void IOBasic_WriteGF (cGH *GH, { file_extension = "unknown"; } - sprintf (filename, "%s/%s_%s.tl", myGH->outdirScalar, alias, - file_extension); + /* skip the pathname if output goes into current directory */ + if (strcmp (myGH->outdirScalar, ".")) + { + sprintf (filename, "%s/%s_%s.tl", myGH->outdirScalar, alias, + file_extension); + } + else + { + sprintf (filename, "%s_%s.tl", alias, file_extension); + } } /* see if output files for this alias name were already created */ -- cgit v1.2.3