diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/playlist.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/apps/playlist.c b/apps/playlist.c index 88a6869895..32b8383442 100644 --- a/apps/playlist.c +++ b/apps/playlist.c | |||
@@ -1741,6 +1741,20 @@ static int check_subdir_for_music(char *dir, const char *subdir, bool recurse) | |||
1741 | 1741 | ||
1742 | /* | 1742 | /* |
1743 | * Returns absolute path of track | 1743 | * Returns absolute path of track |
1744 | * | ||
1745 | * dest: output buffer | ||
1746 | * src: the file name from the playlist | ||
1747 | * dir: the absolute path to the directory where the playlist resides | ||
1748 | * | ||
1749 | * The type of path in "src" determines what will be written to "dest": | ||
1750 | * | ||
1751 | * 1. UNIX-style absolute paths (/foo/bar) remain unaltered | ||
1752 | * 2. Windows-style absolute paths (C:/foo/bar) will be converted into an | ||
1753 | * absolute path by replacing the drive letter with the volume that the | ||
1754 | * *playlist* resides on, ie. the volume in "dir" | ||
1755 | * 3. Relative paths are converted to absolute paths by prepending "dir". | ||
1756 | * This also applies to Windows-style relative paths "C:foo/bar" where | ||
1757 | * the drive letter is accepted but ignored. | ||
1744 | */ | 1758 | */ |
1745 | static ssize_t format_track_path(char *dest, char *src, int buf_length, | 1759 | static ssize_t format_track_path(char *dest, char *src, int buf_length, |
1746 | const char *dir) | 1760 | const char *dir) |
@@ -1770,27 +1784,13 @@ static ssize_t format_track_path(char *dest, char *src, int buf_length, | |||
1770 | /* Replace backslashes with forward slashes */ | 1784 | /* Replace backslashes with forward slashes */ |
1771 | path_correct_separators(src, src); | 1785 | path_correct_separators(src, src); |
1772 | 1786 | ||
1773 | /* Drive letters have no meaning here; handle DOS style drive letter | 1787 | /* Handle Windows-style absolute paths */ |
1774 | * and parse greedily so that: | ||
1775 | * | ||
1776 | * 1) "c:/foo" is fully qualified, use directory volume only | ||
1777 | * 2) "c:foo" is relative to current directory on C, use directory path | ||
1778 | * | ||
1779 | * Assume any volume on the beginning of the directory path is actually | ||
1780 | * the volume on which it resides. This may not be the case if the dir | ||
1781 | * param contains a path such as "/<1>/foo/../../<0>/bar", which refers | ||
1782 | * to "/<0>/bar" (aka "/bar" at this time). *fingers crossed* | ||
1783 | * | ||
1784 | * If any stripped drive spec was absolute, prepend the playlist | ||
1785 | * directory's volume spec, or root if none. Absolute UNIX-style paths | ||
1786 | * remain unaltered. | ||
1787 | */ | ||
1788 | if (path_strip_drive(src, (const char **)&src, true) >= 0 && | 1788 | if (path_strip_drive(src, (const char **)&src, true) >= 0 && |
1789 | src[-1] == PATH_SEPCH) | 1789 | src[-1] == PATH_SEPCH) |
1790 | { | 1790 | { |
1791 | #ifdef HAVE_MULTIVOLUME | 1791 | #ifdef HAVE_MULTIVOLUME |
1792 | const char *p; | 1792 | const char *p; |
1793 | path_strip_volume(dir, &p, false); | 1793 | path_strip_last_volume(dir, &p, false); |
1794 | dir = strmemdupa(dir, p - dir); /* empty if no volspec on dir */ | 1794 | dir = strmemdupa(dir, p - dir); /* empty if no volspec on dir */ |
1795 | #else | 1795 | #else |
1796 | dir = ""; /* only volume is root */ | 1796 | dir = ""; /* only volume is root */ |