Changeset 4435
- Timestamp:
- 10/17/03 17:30:50 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/j/src/org/armedbear/lisp/Utilities.java
r4100 r4435 3 3 * 4 4 * Copyright (C) 2003 Peter Graves 5 * $Id: Utilities.java,v 1. 3 2003-09-28 15:58:48piso Exp $5 * $Id: Utilities.java,v 1.4 2003-10-17 17:30:50 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 22 22 package org.armedbear.lisp; 23 23 24 public final class Utilities 24 import java.io.File; 25 26 public final class Utilities extends Lisp 25 27 { 26 private static final boolean isPlatformWindows = 27 System.getProperty("os.name").startsWith("Windows"); 28 private static final boolean isPlatformUnix; 29 private static final boolean isPlatformWindows; 30 31 static { 32 String osName = System.getProperty("os.name"); 33 isPlatformUnix = osName.startsWith("Linux") || 34 osName.startsWith("Mac OS X") || osName.startsWith("Solaris") || 35 osName.startsWith("SunOS") || osName.startsWith("AIX"); 36 isPlatformWindows = osName.startsWith("Windows"); 37 } 38 39 public static boolean isPlatformUnix() 40 { 41 return isPlatformUnix; 42 } 28 43 29 44 public static boolean isPlatformWindows() … … 59 74 } 60 75 76 public static File getFile(LispObject pathspec) throws ConditionThrowable 77 { 78 String namestring; 79 if (pathspec instanceof LispString) 80 namestring = ((LispString)pathspec).getValue(); 81 else if (pathspec instanceof Pathname) 82 namestring = ((Pathname)pathspec).getNamestring(); 83 else 84 throw new ConditionThrowable(new TypeError(pathspec, 85 "pathname designator")); 86 if (isFilenameAbsolute(namestring)) { 87 if (isPlatformUnix()) { 88 if (namestring.length() > 0 && namestring.charAt(0) == '~') { 89 namestring = 90 System.getProperty("user.home").concat(namestring.substring(1)); 91 } 92 } 93 return new File(namestring); 94 } 95 return new File( 96 LispString.getValue(_DEFAULT_PATHNAME_DEFAULTS_.symbolValue()), 97 namestring); 98 } 99 61 100 public static final char toUpperCase(char c) 62 101 {
Note: See TracChangeset
for help on using the changeset viewer.