Changeset 11202


Ignore:
Timestamp:
Oct 23, 2008, 9:50:17 AM (11 years ago)
Author:
gb
Message:

PATHNAME-ENCODING-NAME returns an encoding name, even on platforms
(darwin, windows) where it's hardwired. On those platforms,
SET-PATHNAME-ENCODING-NAME returns the hardwired name.

FD-OPEN-PATH split off from FD-OPEN, sometimes pays attention
to PATHNAME-ENCODING-NAME.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/level-0/l0-io.lisp

    r11200 r11202  
    197197(let* ((pathname-encoding-name ()))
    198198  (defun pathname-encoding-name ()
    199     pathname-encoding-name)
     199    #+darwin-target :utf-8
     200    #+windows-target :utf-16le
     201    #-(or darwin-target windows-target) pathname-encoding-name)
    200202  (defun set-pathname-encoding-name (new)
    201203    #+(or darwin-target windows-target) (declare (ignore new))
     204    #+darwin-target :utf-8
     205    #+windows-target :utf-16le
    202206    #-(or darwin-target windows-target)
    203207    (let* ((encoding (ensure-character-encoding new)))
     
    207211
    208212
    209    
    210 (defun fd-open (path flags &optional (create-mode #o666))
    211   (with-filename-cstrs ((p path))
    212     (let* ((fd (int-errno-ffcall
     213(defun fd-open-path (p flags create-mode)
     214  (let* ((fd (int-errno-ffcall
    213215              (%kernel-import target::kernel-import-lisp-open)
    214216              :address p :int flags :mode_t create-mode :int)))
     
    221223                (%kernel-import target::kernel-import-lisp-open)
    222224                :address p :int flags :mode_t create-mode :int)))
    223     fd)))
     225    fd))
     226
     227(defun fd-open (path flags &optional (create-mode #o666))
     228  #+darwin-target (with-utf-8-cstrs ((p path))
     229                    (fd-open-path p flags create-mode))
     230  #+windows-target (with-native-utf-16-cstrs ((p path))
     231                     (fd-open-path p flags create-mode))
     232  #-(or darwin-target windows-target)
     233  (let* ((encoding (pathname-encoding-name)))
     234    (if encoding
     235      (with-encoded-cstrs encoding ((p path))
     236        (fd-open-path p flags create-mode))
     237      (with-cstrs ((p path))
     238        (fd-open-path p flags create-mode)))))
    224239
    225240(defun fd-chmod (fd mode)
Note: See TracChangeset for help on using the changeset viewer.