From af22a6a824c9e3dfefe64328853b4e9d87cbf60e Mon Sep 17 00:00:00 2001 From: ep Date: Mon, 26 Jul 2021 10:22:56 +0700 Subject: [PATCH] +readability, hopefully --- data/core/common.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/data/core/common.lua b/data/core/common.lua index 0c1cf0e..bd6d52e 100644 --- a/data/core/common.lua +++ b/data/core/common.lua @@ -285,9 +285,9 @@ end function common.relative_path(ref_dir, dir) - if #ref_dir>2 and ref_dir:sub(2,2)==':' - and #dir>2 and dir:sub(2,2)==':' - and ref_dir:sub(1,1)~=dir:sub(1,1) then + local drive_pattern = "^(%a):\\" + local drive, ref_drive = dir:match(drive_pattern), ref_dir:match(drive_pattern) + if drive and ref_drive and drive ~= ref_drive then -- Windows, different drives, system.absolute_path fails for C:\..\D:\ return dir end