25package trial.org.direct_bt;
28import java.nio.file.Files;
30import org.direct_bt.BTFactory;
31import org.jau.io.PrintUtil;
40 if( !file.isDirectory() ) {
41 final boolean res2 = file.mkdirs();
42 PrintUtil.println(System.err,
"****** KEY_PATH '"+file.toString()+
"': mkdir: "+res2);
45 PrintUtil.println(System.err,
"****** KEY_PATH '"+file.toString()+
"': already exists");
47 }
catch(
final Throwable t) {
48 PrintUtil.println(System.err,
"****** KEY_PATH '"+file.toString()+
"': Caught "+t.getMessage());
55 if( !file.isDirectory() ) {
56 final boolean res2 = file.mkdirs();
57 PrintUtil.println(System.err,
"****** KEY_PATH '"+file.toString()+
"': mkdir: "+res2);
60 PrintUtil.println(System.err,
"****** KEY_PATH '"+file.toString()+
"': already exists");
62 }
catch(
final Throwable t) {
63 PrintUtil.println(System.err,
"****** KEY_PATH '"+file.toString()+
"': Caught "+t.getMessage());
76 private static boolean delete(
final File file,
final boolean recursive) {
77 boolean rm_parent =
true;
78 final File[] contents = file.listFiles();
79 if (contents !=
null) {
80 for (
final File f : contents) {
81 if( f.isDirectory() && !Files.isSymbolicLink( f.toPath() ) ) {
83 rm_parent = delete(f,
true) && rm_parent;
90 rm_parent = f.delete() && rm_parent;
91 }
catch(
final Exception e ) {
100 return file.delete();
101 }
catch(
final Exception e ) { e.printStackTrace(); }
112 if( file.isDirectory() ) {
113 final boolean res2 = delete(file,
false );
115 PrintUtil.println(System.err,
"****** KEY_PATH '"+file.toString()+
"': delete: "+res2);
117 }
catch(
final Throwable t) {
118 PrintUtil.println(System.err,
"****** KEY_PATH '"+file.toString()+
"': Caught "+t.getMessage());
125 if( file.isDirectory() ) {
126 final boolean res2 = delete(file,
false );
128 PrintUtil.println(System.err,
"****** KEY_PATH '"+file.toString()+
"': delete: "+res2);
130 }
catch(
final Throwable t) {
131 PrintUtil.println(System.err,
"****** KEY_PATH '"+file.toString()+
"': Caught "+t.getMessage());
One stop BTManager API entry point.
static synchronized void initDirectBTLibrary()
Preloads the DirectBT native library w/o instantiating BTManager.
static final String SERVER_KEY_PATH
static final String CLIENT_KEY_PATH
static final boolean mkdirKeyFolder()
static final boolean rmKeyFolder()