summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2020-02-06 14:06:53 +0100
committerwm4 <wm4@nowhere>2020-02-06 14:10:40 +0100
commit31acec543819cf56d63dddae59507858b1229b75 (patch)
tree6895aee82a7e151cd46b62946db3a4db32cbcfe1 /test
parent1293c40623bc718b0b1a238a86d681e1f0ee5278 (diff)
downloadmpv-31acec543819cf56d63dddae59507858b1229b75.tar.bz2
mpv-31acec543819cf56d63dddae59507858b1229b75.tar.xz
path: change win32 semantics for joining drive-relative paths
win32 is a cursed abomination which has "drive letters" at the root of the filesystem namespace for no reason. This requires special handling beyond tolerating the idiotic "\" path separator. Even more cursed is the fact that a path starting with a drive letter can be a relative path. For example, "c:billsucks" is actually a relative path to the current working directory of the C drive. So for example if the current working directory is "c:/windowsphone", then "c:billsucks" would reference "c:/windowsphone/billsucks". You should realize that win32 is a ridiculous satanic trash fire by the point you realize that win32 has at least 26 current working directories, one for each drive letter. Anyway, the actual problem is that mpv's mp_path_join() function would return a relative path if an absolute relative path is joined with a drive-relative path. This should never happen; I bet it breaks a lot of assumptions (maybe even some security or safety relevant ones, but probably not). Since relative drive paths are such a fucked up shit idea, don't try to support them "properly", and just solve the problem at hand. The solution produces a path that should be invalid on win32. Joining two relative paths still behaves the same; this is probably OK (maybe). The change isn't very minimal due to me rewriting parts of it without strict need, but I don't care. Note that the Python os.path.join() function (after which the mpv function was apparently modeled) has the same problem.
Diffstat (limited to 'test')
-rw-r--r--test/paths.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/test/paths.c b/test/paths.c
index 5ec2eb8859..434a7996ad 100644
--- a/test/paths.c
+++ b/test/paths.c
@@ -36,7 +36,7 @@ static void run(struct test_ctx *ctx)
TEST_JOIN("c:\\a", "c:\\b", "c:\\b");
TEST_JOIN("c:/a", "c:/b", "c:/b");
// Note: drive-relative paths are not always supported "properly"
- TEST_JOIN("c:/a", "d:b", "d:b");
+ TEST_JOIN("c:/a", "d:b", "c:/a/d:b");
TEST_JOIN("c:a", "b", "c:a/b");
TEST_JOIN("c:", "b", "c:b");
#endif