< prev index next >

src/java.smartcardio/unix/classes/sun/security/smartcardio/PlatformPCSC.java

Print this page
rev 59383 : [mq]: final
   1 /*
   2  * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  67                     }
  68                     initialize(library);
  69                     return null;
  70                 } catch (Throwable e) {
  71                     return e;
  72                 }
  73             }
  74         });
  75     }
  76 
  77     // expand $LIBISA to the system specific directory name for libraries
  78     private static String expand(String lib) {
  79         int k = lib.indexOf("$LIBISA");
  80         if (k == -1) {
  81             return lib;
  82         }
  83         String s1 = lib.substring(0, k);
  84         String s2 = lib.substring(k + 7);
  85         String libDir;
  86         if ("64".equals(System.getProperty("sun.arch.data.model"))) {
  87             if ("SunOS".equals(System.getProperty("os.name"))) {
  88                 libDir = "lib/64";
  89             } else {
  90                 // assume Linux convention
  91                 libDir = "lib64";
  92             }
  93         } else {
  94             // must be 32-bit
  95             libDir = "lib";
  96         }
  97         String s = s1 + libDir + s2;
  98         return s;
  99     }
 100 
 101     private static String getLibraryName() throws IOException {
 102         // if system property is set, use that library
 103         String lib = expand(System.getProperty(PROP_NAME, "").trim());
 104         if (lib.length() != 0) {
 105             return lib;
 106         }
 107         lib = expand(LIB1);
 108         if (new File(lib).isFile()) {
 109             // if LIB1 exists, use that
 110             return lib;
 111         }
 112         lib = expand(LIB2);


   1 /*
   2  * Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  67                     }
  68                     initialize(library);
  69                     return null;
  70                 } catch (Throwable e) {
  71                     return e;
  72                 }
  73             }
  74         });
  75     }
  76 
  77     // expand $LIBISA to the system specific directory name for libraries
  78     private static String expand(String lib) {
  79         int k = lib.indexOf("$LIBISA");
  80         if (k == -1) {
  81             return lib;
  82         }
  83         String s1 = lib.substring(0, k);
  84         String s2 = lib.substring(k + 7);
  85         String libDir;
  86         if ("64".equals(System.getProperty("sun.arch.data.model"))) {



  87             // assume Linux convention
  88             libDir = "lib64";

  89         } else {
  90             // must be 32-bit
  91             libDir = "lib";
  92         }
  93         String s = s1 + libDir + s2;
  94         return s;
  95     }
  96 
  97     private static String getLibraryName() throws IOException {
  98         // if system property is set, use that library
  99         String lib = expand(System.getProperty(PROP_NAME, "").trim());
 100         if (lib.length() != 0) {
 101             return lib;
 102         }
 103         lib = expand(LIB1);
 104         if (new File(lib).isFile()) {
 105             // if LIB1 exists, use that
 106             return lib;
 107         }
 108         lib = expand(LIB2);


< prev index next >