Permalink
Browse files

Adding missing file-search-upward fn

  • Loading branch information...
1 parent a22407f commit 58b28decea845406cf6ed653d3d80c1c4570e316 @mattkeller committed Apr 10, 2012
Showing with 13 additions and 0 deletions.
  1. +13 −0 java.el
View
13 java.el
@@ -85,4 +85,17 @@
(switch-to-buffer-other-window curbuf)
(call-process "ant" nil outbuf t "-emacs" "-f" buildfile target)))
+(defun file-search-upward (directory file)
+ "search a file upward"
+ (let* ((updir (file-truename (concat (file-name-directory directory) "../")))
+ (curfd (if (not (string= (substring directory (- (length directory) 1)) "/"))
+ (concat directory "/" file)
+ (concat directory file))))
+ (if (file-exists-p curfd)
+ curfd
+ (if (and (not (string= (file-truename directory) updir))
+ (< (length updir) (length (file-truename directory))))
+ (file-search-upward updir file)
+ nil))))
+
(provide 'java)

0 comments on commit 58b28de

Please sign in to comment.