MSYS2-packages/mc/0003-vfs-win32-absolute-paths.patch
2020-09-18 10:07:33 +02:00

35 lines
1.0 KiB
Diff

--- lib/vfs/path.c.orig 2020-07-05 21:35:07.000000000 +0200
+++ lib/vfs/path.c 2020-08-27 14:41:35.802799500 +0200
@@ -142,11 +142,19 @@
if (!IS_PATH_SEP (*path))
{
- /* Relative to current directory */
-
char *local;
- if (g_str_has_prefix (path, VFS_ENCODING_PREFIX))
+ if (path[0] != NULL && isalpha (path[0]) &&
+ path[1] != NULL && path[1] == ':' &&
+ IS_PATH_SEP (path[2]))
+ {
+ /* Win32 absolute path */
+ local = g_strdup (path);
+ /* Transform "X:/" into "/X/" */
+ local[1] = local[0];
+ local[0] = local[2];
+ }
+ else if (g_str_has_prefix (path, VFS_ENCODING_PREFIX))
{
/*
encoding prefix placed at start of string without the leading slash
@@ -156,6 +164,8 @@
}
else
{
+ /* Relative to current directory */
+
const char *curr_dir;
curr_dir = vfs_get_current_dir ();