From c5a89386f273473954ec5f9e460052c175236c16 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Thu, 15 Jul 2021 15:13:03 +0200 Subject: GUI: Run all jobs with same CWD as GUI itself This requires changing all the paths to relative ones. Previously, the jobs ran with their CWDs set to the corresponding "result" folder. The trouble is, this breaks everything that uses a relative location: image filenames, mask/satmap files referenced by the geometry, etc. Note that this change also means that the temporary folders ("indexamajig.XXX") are now produced in the top-level working directory. Eventually, a GUI option should be added to allow these folders to be put somewhere better (i.e. somewhere fast). Closes: https://gitlab.desy.de/thomas.white/crystfel/-/issues/44 --- src/crystfel_gui.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/crystfel_gui.c') diff --git a/src/crystfel_gui.c b/src/crystfel_gui.c index ff66b6c3..91b91413 100644 --- a/src/crystfel_gui.c +++ b/src/crystfel_gui.c @@ -1500,3 +1500,20 @@ char *make_new_job_title(const char *orig_old_title) return new_title; } } + + +char *relative_to_cwd(GFile *workdir, const char *filename) +{ + GFile *current_dir; + GFile *gfile; + char *rel; + + current_dir = g_file_new_for_path("."); + + gfile = g_file_get_child(workdir, filename); + rel = g_file_get_relative_path(current_dir, gfile); + g_object_unref(gfile); + g_object_unref(current_dir); + + return rel; +} -- cgit v1.2.3