aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mapper.c12
-rw-r--r--src/mapper.h8
-rw-r--r--src/playlist_save.c2
3 files changed, 20 insertions, 2 deletions
diff --git a/src/mapper.c b/src/mapper.c
index 6317c2f77..b3f86da00 100644
--- a/src/mapper.c
+++ b/src/mapper.c
@@ -84,13 +84,23 @@ rmp2amp_r(char *dst, const char *rel_path)
}
const char *
+map_uri_fs(const char *uri, char *buffer)
+{
+ assert(uri != NULL);
+ assert(*uri != '/');
+ assert(buffer != NULL);
+
+ return rmp2amp_r(buffer, utf8_to_fs_charset(buffer, uri));
+}
+
+const char *
map_directory_fs(const struct directory *directory, char *buffer)
{
const char *dirname = directory_get_path(directory);
if (isRootDirectory(dirname))
return music_dir;
- return rmp2amp_r(buffer, utf8_to_fs_charset(buffer, dirname));
+ return map_uri_fs(dirname, buffer);
}
const char *
diff --git a/src/mapper.h b/src/mapper.h
index e8249b27d..2aecd9a52 100644
--- a/src/mapper.h
+++ b/src/mapper.h
@@ -33,6 +33,14 @@ void mapper_init(void);
void mapper_finish(void);
/**
+ * Determines the absolute file system path of a relative URI. This
+ * is basically done by converting the URI to the file system charset
+ * and prepending the music directory.
+ */
+const char *
+map_uri_fs(const char *uri, char *buffer);
+
+/**
* Determines the file system path of a directory object.
*
* @param directory the directory object
diff --git a/src/playlist_save.c b/src/playlist_save.c
index 2568d4293..b07137d9e 100644
--- a/src/playlist_save.c
+++ b/src/playlist_save.c
@@ -48,7 +48,7 @@ playlist_print_uri(FILE *file, const char *uri)
if (playlist_saveAbsolutePaths && !isRemoteUrl(uri) &&
uri[0] != '/')
- s = map_directory_child_fs(db_get_root(), uri, tmp);
+ s = map_uri_fs(uri, tmp);
else
s = utf8_to_fs_charset(tmp, uri);