Changeset 10033


Ignore:
Timestamp:
Jul 15, 2008, 1:22:23 PM (11 years ago)
Author:
gb
Message:

Real-er %REALPATH for Windows.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/win64/level-1/linux-files.lisp

    r9824 r10033  
    561561#+windows-target
    562562(defun %windows-realpath (namestring)
    563   (let* ((len (length namestring))
    564          (real
    565           (if (< len 2)
    566             namestring
    567             (let* ((c0 (schar namestring 0))
    568                    (c1 (schar namestring 1)))
    569               (if (or (eql c0 #\/)
    570                       (eql c0 #\\)
    571                       (eql c1 #\:))
    572                 namestring
    573                 (concatenate 'string (current-directory-name) "/" namestring))))))
    574     (when (%stat real)
    575       real)))
     563  (with-filename-cstrs ((path namestring))
     564    (do* ((bufsize 256))
     565         ()
     566      (%stack-block ((buf bufsize))
     567        (let* ((nchars (#_GetFullPathNameW path (ash bufsize -1) buf +null-ptr+)))
     568          (if (eql 0 nchars)
     569            (return nil)
     570            (let* ((max (+ nchars nchars 2)))
     571              (if (> max bufsize)
     572                (setq bufsize max)
     573                (let* ((real (get-foreign-namestring buf)))
     574                  (return (and (%stat real) real)))))))))))
     575
    576576   
    577577;;; This doesn't seem to exist on VxWorks.  It's a POSIX
Note: See TracChangeset for help on using the changeset viewer.