about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMaximilian Wuttke <mwuttke97@posteo.de>2021-03-09 20:45:29 +0100
committerMaximilian Wuttke <mwuttke97@posteo.de>2021-03-09 20:45:29 +0100
commit1576ac11cbfddd15e5e0e31e5dcb0df5d57c2b5c (patch)
tree7311f5a5f6299094c838b0d1386ccbee6bd197f5
parenta4ec8530a99b054d44a0a5f66562d0512c2ca0e2 (diff)
downloadprofani-tty-1576ac11cbfddd15e5e0e31e5dcb0df5d57c2b5c.tar.gz
Remove "file://" from file names
Rationale: When copying an image in some application, a URL instead of a
path is copied to the clipboard.
-rw-r--r--src/common.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/common.c b/src/common.c
index 75139676..6defa7c1 100644
--- a/src/common.c
+++ b/src/common.c
@@ -577,6 +577,9 @@ get_expanded_path(const char* path)
     GString* exp_path = g_string_new("");
     gchar* result;
 
+    if (g_str_has_prefix(path, "file://")) {
+        path += strlen("file://");
+    }
     if (strlen(path) >= 2 && path[0] == '~' && path[1] == '/') {
         g_string_printf(exp_path, "%s/%s", getenv("HOME"), path + 2);
     } else {