Re: [eclipse-clp-users] canonical_path_bug/2 bug on Windows... again

From: Joachim Schimpf <jschimpf_at_...311...>
Date: Tue, 22 May 2012 13:16:47 +0200
Paulo Moura wrote:
> Hi,
> 
> I'm using ECLiPSe 6.1#112 on Windows 7 64 bits. The built-in predicate canonical_path_bug/2 always seem to return the wrong path when the first argument is an absolute path such as 'C:/Users/' or 'C:\\Users\\'. The returned path always have the current working directory as a prefix. Moreover, if the first argument starts with an environment variable, the variable is not expanded and again the returned path have the current working directory as a prefix. I reported this bug (which was fixed on 5.x) on July 13, 2006.

Hi Paulo,

You have overlooked that ECLiPSe internally uses an OS-independent path
name syntax which employs no separator characters apart from the "/".
In this syntax, absolute paths always start with a /.

The ONLY predicate that understands OS-specific path names is
os_file_name(?EclipseName, ?OSName), which converts between operating
system syntax and internal Eclipse syntax.  For example, on Windows,
os_file_name("//C/a/b", "C:\\a\\b") is true.  ALL other built-in
predicates that accept/return path names, expect/produce the
simplified internal form.  If you have path names that come in
OS syntax, you will have to convert them once.

This is an old (but clean) design decision dating back to the first
Windows-port of ECLiPSe in the 90s, when there was still much confusion
about file name syntax in different operating systems.  The kind of "fix"
you have in mind would break the design.  However, I'm open to suggestions
of how to make things more intuitive and/or nore compatible with other
systems.

Cheers,
Joachim
Received on Tue May 22 2012 - 11:16:53 CEST

This archive was generated by hypermail 2.3.0 : Tue Apr 16 2024 - 09:13:20 CEST