From 76e00e89876cc82865e52f7fa7c01f5914366c50 Mon Sep 17 00:00:00 2001 From: knarf Date: Wed, 11 Jan 2012 21:44:26 +0000 Subject: make checkpoint_dir steerable. This requires the checkpoint_dir to be created not only at startup, and the only point in which this can be helped with in this thorn is in IOUtil_AssembleFilename() which is called by using thorns to get the file name of the checkpoint - this is repeated there now git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/IOUtil/trunk@286 b32723a9-ab3a-4a60-88e2-2e5d99d7c17a --- param.ccl | 2 +- src/CheckpointRecovery.c | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/param.ccl b/param.ccl index affe632..da9f22f 100644 --- a/param.ccl +++ b/param.ccl @@ -167,7 +167,7 @@ STRING recover_file "Basename of recovery file" STEERABLE = ALWAYS { ".+" :: "A valid filename" } "checkpoint.chkpt" -STRING checkpoint_dir "Output directory for checkpoint files" STEERABLE = RECOVER +STRING checkpoint_dir "Output directory for checkpoint files" STEERABLE = ALWAYS { ".+" :: "A valid directory name" } "." diff --git a/src/CheckpointRecovery.c b/src/CheckpointRecovery.c index 2101857..0c27a7f 100644 --- a/src/CheckpointRecovery.c +++ b/src/CheckpointRecovery.c @@ -209,11 +209,19 @@ char *IOUtil_AssembleFilename (const cGH *GH, case CP_INITIAL_DATA: dir = checkpoint_dir; basename = checkpoint_ID_file; + if (CCTK_CreateDirectory(0755, checkpoint_dir) < 0) + CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING, + "Checkpoint directory %s could not be created", + checkpoint_dir); break; case CP_EVOLUTION_DATA: dir = checkpoint_dir; basename = checkpoint_file; + if (CCTK_CreateDirectory(0755, checkpoint_dir) < 0) + CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING, + "Checkpoint directory %s could not be created", + checkpoint_dir); break; case CP_RECOVER_DATA: -- cgit v1.2.3