+/* Remote commands from main.c are prepended with the current dir the remote
+ * command was made from. Some remote commands require this. The
+ * value is stored here
+ */
+static gchar *pwd = NULL;
+
+/**
+ * @brief Ensures file path is absolute.
+ * @param[in] filename Filepath, absolute or relative to calling directory
+ * @returns absolute path
+ *
+ * If first character of input filepath is not the directory
+ * separator, assume it as a relative path and prepend
+ * the directory the remote command was initiated from
+ *
+ * Return value must be freed with g_free()
+ */
+static gchar *set_pwd(gchar *filename)
+{
+ gchar *temp;
+
+ if (strncmp(filename, G_DIR_SEPARATOR_S, 1) != 0)
+ {
+ temp = g_build_filename(pwd, filename, NULL);
+ }
+ else
+ {
+ temp = g_strdup(filename);
+ }
+
+ return temp;
+}