diff --git a/mcsrc/lib/strescape.h b/mcsrc/lib/strescape.h index a24f5d6..def5467 100644 --- a/mcsrc/lib/strescape.h +++ b/mcsrc/lib/strescape.h @@ -20,6 +20,7 @@ char *strutils_escape (const char *src, gsize src_len, const char *escaped_chars char *strutils_unescape (const char *src, gsize src_len, const char *unescaped_chars, gboolean unescape_non_printable); char *strutils_shell_unescape (const char *text); +char *strutils_shell_unescape_special (const char *text); //WIN32 char *strutils_shell_escape (const char *text); char *strutils_glob_escape (const char *text); diff --git a/mcsrc/lib/strutil/strescape.c b/mcsrc/lib/strutil/strescape.c index 1412fee..7c40e63 100644 --- a/mcsrc/lib/strutil/strescape.c +++ b/mcsrc/lib/strutil/strescape.c @@ -220,6 +220,13 @@ strutils_shell_unescape (const char *text) return strutils_unescape (text, -1, ESCAPE_SHELL_CHARS, TRUE); } + +char * +strutils_shell_unescape_special (const char *text) +{ + return strutils_unescape (text, -1, ESCAPE_SHELL_CHARS, FALSE); +} + /* --------------------------------------------------------------------------------------------- */ char * diff --git a/mcsrc/src/filemanager/cd.c b/mcsrc/src/filemanager/cd.c index 65b1f62..7d6d992 100644 --- a/mcsrc/src/filemanager/cd.c +++ b/mcsrc/src/filemanager/cd.c @@ -90,7 +90,11 @@ examine_cd (const char *_path) char *p; /* Tilde expansion */ +#if defined(WIN32) + path = strutils_shell_unescape_special (_path); //only escape specials +#else path = strutils_shell_unescape (_path); +#endif path_tilde = tilde_expand (path); g_free (path); @@ -182,13 +186,13 @@ handle_cdpath (const char *path) cdpath = g_strdup (getenv ("CDPATH")); p = cdpath; - c = (p == NULL) ? '\0' : ':'; + c = (p == NULL) ? '\0' : PATH_ENV_SEP; - while (!result && c == ':') + while (!result && c == PATH_ENV_SEP) { char *s; - s = strchr (p, ':'); + s = strchr (p, PATH_ENV_SEP); if (s == NULL) s = strchr (p, '\0'); c = *s; diff --git a/mcwin32/src/win32_utl.c b/mcwin32/src/win32_utl.c index ccf1f4e..6c7c5ae 100644 --- a/mcwin32/src/win32_utl.c +++ b/mcwin32/src/win32_utl.c @@ -1750,14 +1750,15 @@ tilde_expand(const char *directory) ++directory; } - if (PATH_SEP == *directory) { /* / ==> x:/ */ + if (IS_PATH_SEP(*directory)) { /* '/xxx' ==> 'x:/xxx' */ + const char slash = *directory; - if (PATH_SEP != directory[1] || /* preserve URL's (//