From 40d7f14305b65d0d22872dfbe1119004db7b45e5 Mon Sep 17 00:00:00 2001 From: Juan Jose Garcia Ripoll Date: Wed, 17 Jun 2009 20:20:04 +0200 Subject: [PATCH] TRUENAME now properly reinterprets file pathnames as directory pathnames if the file system shows that the user supplied a wrong value. --- src/CHANGELOG | 6 ++++++ src/c/unixfsys.d | 14 +++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/CHANGELOG b/src/CHANGELOG index f4f6cfb12..47d5ea038 100644 --- a/src/CHANGELOG +++ b/src/CHANGELOG @@ -5,6 +5,10 @@ ECL 9.6.2: - Reimplemented winsock streams using the new file structures (D. Statyvka) + - TRUENAME now properly reinterprets file pathnames as directory pathnames + if the file system shows that the user supplied a wrong value. For instance + (TRUENAME "/tmp") => #P"/tmp/" + * Bugs: - Fixed a bug in the compiler that prevented building with MSVC @@ -19,6 +23,8 @@ ECL 9.6.2: - The command :bds no longer chokes when finding unbound special variables. + - Fixed a problem with SI:MKSTEMP under windows (DS). + * Numerics: - EXT:OUTPUT-FLOAT-NAN and EXT:OUTPUT-FLOAT-INFINITY can be redefined to diff --git a/src/c/unixfsys.d b/src/c/unixfsys.d index 581c400a3..65da587e8 100644 --- a/src/c/unixfsys.d +++ b/src/c/unixfsys.d @@ -260,7 +260,19 @@ cl_truename(cl_object orig_pathname) Cnil, Cnil, Cnil)); #endif } else { - filename = OBJNULL; + /* If the pathname is a directory but we have supplied + a file name, correct the type by appending a directory + separator and re-parsing again the namestring */ + if (kind == @':directory' && + (pathname->pathname.name != Cnil || + pathname->pathname.type != Cnil)) { + pathname = si_base_string_concatenate + (2, filename, + make_constant_base_string("/")); + pathname = cl_pathname(pathname); + cl_print(1,pathname); + goto BEGIN; + } filename = OBJNULL; } change_drive(pathname); for (dir = pathname->pathname.directory;