aboutsummaryrefslogtreecommitdiff
path: root/src/mapper.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2010-07-25 13:18:57 +0200
committerMax Kellermann <max@duempel.org>2010-07-25 13:28:39 +0200
commitb233c145fa28f2a9e90a40993bc35f408d256e08 (patch)
tree81a4520fde88423f5654c3c97fc748ca7065f44e /src/mapper.c
parent9de5bb9e23915f847b59d32d9e857c45974b01d7 (diff)
{queue,song}_print: print relative paths if possible
If a song with an absolute path points inside the music directory, print only the relative part. This happens when partial songs from a playlist file were loaded.
Diffstat (limited to 'src/mapper.c')
-rw-r--r--src/mapper.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/mapper.c b/src/mapper.c
index 03822ca9..108de953 100644
--- a/src/mapper.c
+++ b/src/mapper.c
@@ -93,6 +93,16 @@ mapper_has_music_directory(void)
return music_dir != NULL;
}
+const char *
+map_to_relative_path(const char *path_utf8)
+{
+ return music_dir != NULL &&
+ memcmp(path_utf8, music_dir, music_dir_length) == 0 &&
+ G_IS_DIR_SEPARATOR(path_utf8[music_dir_length])
+ ? path_utf8 + music_dir_length + 1
+ : path_utf8;
+}
+
char *
map_uri_fs(const char *uri)
{