1 /*
2  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3  * Copyright (C) DIGITEO - 2011 - Calixte DENIZET
4  *
5  * Copyright (C) 2012 - 2016 - Scilab Enterprises
6  *
7  * This file is hereby licensed under the terms of the GNU GPL v2.0,
8  * pursuant to article 5.3.4 of the CeCILL v.2.1.
9  * This file was originally licensed under the terms of the CeCILL v2.1,
10  * and continues to be available under such terms.
11  * For more information, see the COPYING file which you should have received
12  * along with this program.
13  *
14  */
15 
16 
17 /* CommonFileUtils.i */
18 /**
19  * Windows: swig -java -package org.scilab.modules.commons -outdir ../java/org/scilab/modules/commons/ CommonFileUtils.i
20  * Other: Use the option --enable-build-swig to the configure
21 */
22 %module CommonFileUtils
23 %{
24 #include "../../includes/fileutils.h"
25 #include "sci_malloc.h"
26 %}
27 
28 %include "../../../jvm/src/jni/scilab_typemaps.i"
29 
30 /* JavaDoc for CommonFileUtilsJNI class */
31 %pragma(java) jniclassclassmodifiers=%{
32 /* It is generated code. Disable checkstyle */
33 //CHECKSTYLE:OFF
34  /**
35    * Some file utils
36    * @author Calixte DENIZET
37    * @copyright DIGITEO 2011
38    */
39 public class%}
40 
41 /* Constructor for CommonFileUtilsJNI class */
42 %pragma(java) jniclasscode="
43   /**
44     * Constructor
45     */
46   protected CommonFileUtilsJNI() {
47     throw new UnsupportedOperationException();
48   }";
49 
50 /* static load of library */
51 %pragma(java) jniclasscode=%{
52   static {
53     try {
54         System.loadLibrary("scicommons");
catch(SecurityException e)55     } catch (SecurityException e) {
56         System.err.println("A security manager exists and does not allow the loading of the specified dynamic library.");
57         System.err.println(e.getLocalizedMessage());
58         System.exit(-1);
59     } catch (UnsatisfiedLinkError e)    {
60            System.err.println("The native library scicommons does not exist or cannot be found.");
61         if (System.getenv("CONTINUE_ON_JNI_ERROR") == null) {
62            System.err.println(e.getLocalizedMessage());
63            System.err.println("Current java.library.path is : "+System.getProperty("java.library.path"));
64            System.exit(-1);
65         }else{
66            System.err.println("Continuing anyway because of CONTINUE_ON_JNI_ERROR");
67         }
68     }
69   }
70 %}
71 
72 
73 /* JavaDoc for CommonFileUtils class */
74 %pragma(java) moduleclassmodifiers="
75  /**
76    * Some file utils
77    * @author Calixte DENIZET
78    * @copyright DIGITEO 2011
79    */
80 public class";
81 
82 /* Constructor for CommonFileUtils class */
83 %pragma(java) modulecode="
84  /**
85    * Constructor
86    */
87  protected CommonFileUtils() {
88     throw new UnsupportedOperationException();
89  }";
90 
91 /* JavaDoc */
92 %javamethodmodifiers isEmptyDirectory(String dirName) "
93  /**
94    * Test if a directory is empty or not
95    * @param dirName the directory name
96    * @return true if it is a directory
97    */
98 public";
99 int isEmptyDirectory(char * dirName);
100 
101 /* JavaDoc */
102 %javamethodmodifiers getCWD() "
103  /**
104    * Get the current working directory
105    * @return the Scilab CWD
106    */
107 public";
108 char * getCWD();
109 
110