1 21 22 package org.armedbear.lisp; 23 24 import java.io.File ; 25 import java.net.URL ; 26 27 public final class Site extends Lisp 28 { 29 private static final String LISP_HOME; 30 31 static { 32 String lispHome = null; 33 URL url = Lisp.class.getResource("boot.lisp"); 34 if (url != null) { 35 String protocol = url.getProtocol(); 36 if (protocol != null && protocol.equals("file")) { 37 String path = url.getPath(); 38 int index = path.lastIndexOf('/'); 39 if (index >= 0) { 40 lispHome = path.substring(0, index + 1); 41 if (Utilities.isPlatformWindows()) { 42 if (lispHome.length() > 0 && lispHome.charAt(0) == '/') 43 lispHome = lispHome.substring(1); 44 } 45 } 46 } 47 } 48 LISP_HOME = lispHome; 49 } 50 51 public static final String getLispHome() 52 { 53 return LISP_HOME; 54 } 55 56 private static final Symbol _LISP_HOME_ = 58 exportSpecial("*LISP-HOME*", PACKAGE_EXT, NIL); 59 60 static { 61 try { 62 String s = Site.getLispHome(); 63 if (s != null) 64 _LISP_HOME_.setSymbolValue(new Pathname(s)); 65 } 66 catch (Throwable t) { 67 Debug.trace(t); 68 } 69 } 70 } 71 | Popular Tags |