A bug on Windows

Started by linli, November 09, 2009, 12:14:23 AM

Previous topic - Next topic

linli

I had the following problem:

> (change-dir "h:")
true
> (real-path)
"H:\"
> (change-dir "c:\a\b")
true
> (real-path)
"c:\a\b"
> (change-dir "h:")
true
> (real-path)
"H:\"
> (change-dir "c:")
true
> (real-path)
"c:\a\b"

In the last step, I was trying to change the dir to c:, but it remains in c:ab

Lutz

#1
With C: without the slash, you only change the drive and to the directory which was current on C: before. If you want to change to root of C: do "C:\" or "C:/". This is standard MS Windows behavior.

bjo

#2
On Windows (Vista) the (file?) built-in does not seem to look in any or all PATHs:



> (file? "libgmp-3.dll")
nil
> (import "libgmp-3.dll" "__gmpz_mul")
__gmpz_mul <1000D880>

cormullion

#3
The manual suggests that import uses search paths: "If the library is not located in the normal library search path, str-lib-name must contain the full path name." but that file? just checks for file/directory existence.

bjo

#4
The problem is that the gmp module depends on (import)'s behaviour when using (file?) to determine which file to use:



(set 'files '(
    "/usr/lib/libgmp.dylib" ; Mac OSX
    [...]
    "libgmp-3.dll" ; Win32 in Path))

(set 'library (files (or
  (find true (map file? files))
    (begin (println "cannot find GMP library") (exit)))))


On windows this piece of code will always fail.

Lutz

#5
'file?' must have the full path-name specified. At least on Windows XP libgmp-3.dll is not installed by default and because of this, the full path-name has not been specified for libgmp-3.dll in the source of the gmp.lsp module.



You can either put libgmp-3.dll into the current directory to make the 'file?' statement in the module work on it, or you can change the path in the module to whatever location the DLL is installed on your machine.



A sentence has been added to the documentation clarifying this:



http://www.newlisp.org/code/modules/gmp.lsp.html">http://www.newlisp.org/code/modules/gmp.lsp.html





ps: welcome to newLISP