Changeset 14581
- Timestamp:
- Jan 17, 2011, 7:14:44 PM (14 years ago)
- File:
-
- 1 edited
-
trunk/source/level-1/linux-files.lisp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/level-1/linux-files.lisp
r14551 r14581 795 795 (= 1 (#_isatty fd))) 796 796 797 #-win64-target 798 (progn 797 799 (defun %open-dir (namestring) 798 800 (with-filename-cstrs ((name namestring)) … … 816 818 #+windows-target :_wdirent.d_name 817 819 #-windows-target :dirent.d_name))))) 820 ) 821 822 #+win64-target 823 (progn 824 (eval-when (:compile-toplevel :execute) 825 (def-foreign-type nil 826 (:struct :win64-dir 827 (:data #>WIN32_FIND_DATAW) 828 (:handle :address) 829 (:state :int)))) 830 831 (defun %open-dir (namestring) 832 ;;; Namestring should end in /*. Honest. 833 (let* ((len (length namestring)) 834 (lastchar (if (> len 0) (schar namestring (1- len)))) 835 (penultimatechar (if (> len 1) (schar namestring (- len 2))))) 836 (unless (and (eql lastchar #\*) 837 (or (eql penultimatechar #\\) 838 (eql penultimatechar #\/))) 839 (if (or (eql lastchar #\\) 840 (eql lastchar #\/)) 841 (setq namestring (concatenate 'string namestring "*")) 842 (setq namestring (concatenate 'string namestring "/*"))))) 843 (let* ((dir (make-record :win64-dir :state -1))) 844 (with-filename-cstrs ((name namestring)) 845 (let* ((handle (#_FindFirstFileW name dir))) 846 (cond ((eql handle #$INVALID_HANDLE_VALUE) 847 (free dir) 848 nil) 849 (t 850 (setf (pref dir :win64-dir.state) 0 851 (pref dir :win64-dir.handle) handle) 852 dir)))))) 853 854 (defun %read-dir (dir) 855 (when (eql 0 (pref dir :win64-dir.state)) 856 (prog1 857 (get-foreign-namestring (pref dir #>WIN32_FIND_DATAW.cFileName)) 858 (if (eql 0 (#_FindNextFileW (pref dir :win64-dir.handle) dir)) 859 (setf (pref dir :win64-dir.state) -1))))) 860 861 (defun close-dir (dir) 862 (#_FindClose (pref dir :win64-dir.handle)) 863 (free dir) 864 nil) 865 ) 866 867 868 869 818 870 819 871
Note:
See TracChangeset
for help on using the changeset viewer.
