aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2020-08-28 13:47:56 +0200
committerThomas White <taw@physics.org>2020-08-28 13:49:55 +0200
commit36fb915b8a930ff5f99ecc2854b88f4b10becdd8 (patch)
tree0079c33be885971473349e4ecaebc087ad2495c9
parent4fec62a6f3f161c6a67229e52c61aedbc5eb0f36 (diff)
Write notes to file
-rw-r--r--src/gui_backend_local.c18
-rw-r--r--src/gui_backend_slurm.c13
2 files changed, 31 insertions, 0 deletions
diff --git a/src/gui_backend_local.c b/src/gui_backend_local.c
index 1bf0c9b6..7411c9a2 100644
--- a/src/gui_backend_local.c
+++ b/src/gui_backend_local.c
@@ -166,6 +166,11 @@ static void *run_indexing(const char *job_title,
struct stat s;
char *workdir;
const char *old_pwd;
+ GFile *workdir_file;
+ GFile *cwd_file;
+ GFile *notes_file;
+ char *notes_path;
+ FILE *fh;
workdir = strdup(job_title);
if ( workdir == NULL ) return NULL;
@@ -182,6 +187,19 @@ static void *run_indexing(const char *job_title,
return NULL;
}
+ cwd_file = g_file_new_for_path(".");
+ workdir_file = g_file_get_child(cwd_file, workdir);
+ g_object_unref(cwd_file);
+
+ notes_file = g_file_get_child(workdir_file, "notes.txt");
+ notes_path = g_file_get_path(notes_file);
+ fh = fopen(notes_path, "w");
+ fputs(job_notes, fh);
+ fclose(fh);
+ g_free(notes_path);
+ g_object_unref(notes_file);
+ g_object_unref(workdir_file);
+
job = malloc(sizeof(struct local_job));
if ( job == NULL ) return NULL;
diff --git a/src/gui_backend_slurm.c b/src/gui_backend_slurm.c
index 985a21ea..3144d10a 100644
--- a/src/gui_backend_slurm.c
+++ b/src/gui_backend_slurm.c
@@ -93,6 +93,9 @@ static void *run_indexing(const char *job_title,
char *script;
GFile *workdir_file;
GFile *cwd_file;
+ GFile *notes_file;
+ char *notes_path;
+ FILE *fh;
workdir = strdup(job_title);
if ( workdir == NULL ) return NULL;
@@ -111,6 +114,16 @@ static void *run_indexing(const char *job_title,
cwd_file = g_file_new_for_path(".");
workdir_file = g_file_get_child(cwd_file, workdir);
+ g_object_unref(cwd_file);
+
+ notes_file = g_file_get_child(workdir_file, "notes.txt");
+ notes_path = g_file_get_path(notes_file);
+ fh = fopen(notes_path, "w");
+ fputs(job_notes, fh);
+ fclose(fh);
+ g_free(notes_path);
+ g_object_unref(notes_file);
+ g_object_unref(workdir_file);
cmdline = indexamajig_command_line(geom_filename,
"`nproc`",