Re : Re : 'built-in' config file not found by eclipse

Iban HATCHONDO <[email protected]> Tue, 27 Apr 2010 12:10:31 +0000 (GMT)
Newsgroups gmane.comp.window-managers.eclipse
Message-ID <[email protected]>
This has been committed in the CVS tree

Best,
Iban.



----- Message d'origine ----
De : Iban HATCHONDO <[email protected]>
=C0 : [email protected]
Envoy=E9 le : Lun 26 avril 2010, 12 h 43 min 08 s
Objet : [eclipse-devel] Re :  'built-in' config file not found by eclipse

Well, you're right, I haven't paid attention that SBCL returns a valid path=
name when probing a file with a pathname for a directory that is in reality=
 a file.
I would propose the following (after reading the interesting point CL-FAD)


(defun file-exists-p (filename)
  "Returns true if the given filename is an existing file and not a directo=
ry."
  (and #+clisp (not (probe-directory (make-pathname :directory filename)))
       #-clisp (let ((pathname (probe-file (make-pathname :directory filena=
me))))
                 ;; When NIL is returned by probe-file, it indicates that NO
                 ;; directory exists under this filename.
                 ;; But when a valid pathname is returned, it does not =

                 ;; necessarily indicate that it is a directory.
                 ;; In this case, one needs to check if the returned pathna=
me
                 ;; has a type or a name, what a directory pathname doesn't
                 ;; have.
                 ;; This last case concerns systems like SBCL, while the fo=
rmer
                 ;; case corresponds at least to CMUCL.
                 (if pathname
                     (let ((name (pathname-name pathname))
                           (type (pathname-type pathname)))
                       (or (and type (not (eql type :unspecific)))
                           (and name (not (eql type :unspecific)))))
                     t))
       (probe-file filename)))

It seems be the proper way to deal with systems that have equivalent behavi=
or to SBCL?

Best,
Iban.


----- Message d'origine ----
De : david thompson <[email protected]>
=C0 : [email protected]
Envoy=E9 le : Sam 24 avril 2010, 21 h 49 min 14 s
Objet : [eclipse-devel] 'built-in' config file not found by eclipse

I tried out the most recent CVS version. The problem with the
preexisting ~/.eclipse directory seems to be resolved. However, now
eclipse doesn't find the 'built-in' config file with SBCL:

EWMI> (eclipse::file-exists-p (eclipse-path "eclipserc"))
NIL
EWMI> (eclipse-path "eclipserc")
"/home/thomp/downloads/window-managers/eclipse-cvs/eclipse/eclipserc"

but the file is present:

d630:eclipse# ls -al
/home/thomp/downloads/window-managers/eclipse-cvs/eclipse/eclipserc
-rw-r--r-- 1 root root 2834 2003-08-28 07:51
/home/thomp/downloads/window-managers/eclipse-cvs/eclipse/eclipserc


I think the issue might be with FILE-EXISTS-P - in SBCL, it looks like
a nonsensical path is generated:

EWMI> (probe-file (eclipse-path "eclipserc"))
#P"/home/thomp/downloads/window-managers/eclipse-cvs/eclipse/eclipserc"
EWMI> (not (probe-file (make-pathname :directory (eclipse-path "eclipserc")=
)))
NIL
EWMI> (make-pathname :directory (eclipse-path "eclipserc"))
#P"//home/thomp/downloads/window-managers/eclipse-cvs/eclipse/eclipserc/"


CL-FAD has some 'directory-p and file-p'-ish functionality that is
intended to be portable across implementations. It might be a useful
starting point. On the other hand, I also vaguely remember some weird
behavior (e.g., I think the CL-FAD DIRECTORY-EXISTS-P function returns
a true value when fed an empty string).

For what it's worth, this (in global.lisp) seems to work with SBCL with lin=
ux:

(defun directory-p (pathname)
  (let ((close?
     (ignore-errors
       (sb-posix:opendir pathname))))
    (if close? (sb-posix:closedir close?))))


(defun file-exists-p (filename)
  "Returns true if the given filename is an existing file and not a directo=
ry."
  (and
   #+sbcl (not (directory-p filename))
   #+clisp (not (probe-directory (make-pathname :directory filename)))
   #-(or :clisp :sbcl) (not (probe-file (make-pathname :directory filename)=
))
   (probe-file filename)))

_______________________________________________
eclipse-devel site list
[email protected]
http://common-lisp.net/mailman/listinfo/eclipse-devel



      =



_______________________________________________
eclipse-devel site list
[email protected]
http://common-lisp.net/mailman/listinfo/eclipse-devel



      =



_______________________________________________
eclipse-devel site list
[email protected]
http://common-lisp.net/mailman/listinfo/eclipse-devel