summaryrefslogtreecommitdiffstats
path: root/source/theme.c
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2017-06-14 16:19:17 +0200
committerDave Davenport <qball@gmpclient.org>2017-06-14 16:19:17 +0200
commit22aacb8f94f4b6837dc192b98d243da4c2ae3f34 (patch)
tree7793d7e3d260af2839c53f0bae54bdd41aa6db3e /source/theme.c
parentc851134411ac2a2ae75f74f21cde2f3db8e97441 (diff)
Add extra check for rofi_theme_parse_prepare_file
Diffstat (limited to 'source/theme.c')
-rw-r--r--source/theme.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/source/theme.c b/source/theme.c
index 77d4443e..cdfca812 100644
--- a/source/theme.c
+++ b/source/theme.c
@@ -32,6 +32,8 @@
#include <stdlib.h>
#include <errno.h>
#include <string.h>
+// GFile stuff.
+#include <gio/gio.h>
#include "theme.h"
#include "theme-parser.h"
#include "helper.h"
@@ -779,3 +781,22 @@ void rofi_theme_convert_old ( void )
}
}
#endif // THEME_CONVERTER
+
+char * rofi_theme_parse_prepare_file ( const char *file, const char *parent_file )
+{
+ char *filename = rofi_expand_path ( file );
+ // If no absolute path specified, expand it.
+ if ( parent_file != NULL && ! g_path_is_absolute ( filename ) ) {
+ char *basedir = g_path_get_dirname ( parent_file );
+ char *path = g_build_filename ( basedir, filename, NULL );
+ g_free ( filename);
+ filename = path;
+ g_free ( basedir );
+ }
+ GFile *gf = g_file_new_for_path ( filename );
+ g_free(filename);
+ filename = g_file_get_path ( gf );
+ g_object_unref ( gf );
+
+ return filename;
+}