MSYS2-packages/mc/0003-vfs-win32-absolute-paths.patch
2024-08-31 18:33:03 -04:00

40 lines
1.1 KiB
Diff

--- lib/vfs/path.c.orig 2024-08-23 13:22:35.000000000 -0400
+++ lib/vfs/path.c 2024-08-31 14:35:28.694195900 -0400
@@ -147,12 +147,20 @@
if (!IS_PATH_SEP (*path))
{
- /* Relative to current directory */
-
char *local;
+ 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];
+ }
#ifdef HAVE_CHARSET
- if (g_str_has_prefix (path, VFS_ENCODING_PREFIX))
+ else if (g_str_has_prefix (path, VFS_ENCODING_PREFIX))
{
/*
encoding prefix placed at start of string without the leading slash
@@ -160,9 +168,11 @@
*/
local = mc_build_filename (PATH_SEP_STR, path, (char *) NULL);
}
- else
#endif
+ else
{
+ /* Relative to current directory */
+
const char *curr_dir;
curr_dir = vfs_get_current_dir ();