======================================================== =============== FileConnections BEGIN ================== ======================================================== The roots are: file:///a:/ The roots are: file:///A:/ ROOT's OK ******************************************************* ************* FileConnectionInit begin **************** ******************************************************* file:///a:/m2m: Is a Directory() The code for this is: >>>>>>>>>>>>>>>>> The code for this is: <<<<<<<<<<<<<<<<<<<<< //----------------------------------------------------- try{ FileConnection fc; fc = (FileConnection) Connector.open(root + dir_m2m); if(fc.isDirectory()){ System.out.println(root + dir_m2m + ": Is a Directory()"); }else{ System.out.println(root + dir_m2m + ": Is not a Directory()"); } }catch(IOException in){System.out.println("");} //----------------------------------------------------- ******************************************************* ******************************************************* >>>>>>>>>>>>>>>>> The code for fcopen <<<<<<<<<<<<<<<<<<<<< /*****************************************************************************/ /*****************************************************************************/ public boolean fcopen(String root, String dir, String filename){ System.out.println(""); System.out.println("*******************************************************"); System.out.println("****************** fcopen begin ***********************"); System.out.println("*******************************************************"); System.out.println(""); /*---------------------------------------------------------------------------*/ boolean check = false; // file_root = "file:///"; FileConnection fc = null; if (!root.endsWith(file_separator)){ root = root.concat(file_separator); } // add a slash if (!dir.endsWith(file_separator)){ dir = dir.concat(file_separator); } // add a slash String url = root + dir + filename; System.out.println("File(url): " + url); //----------------------------------------------------------------------------- try { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - fc = (FileConnection) Connector.open((url).trim()); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - }catch (IllegalModeException in) { System.out.println("IllegalModeException in fcopen dir: " + in); }catch (IOException in) { System.out.println("IOException in fcopen dir: " + in); }catch (Exception in) { System.out.println("Exception in fcopen dir: " + in); parent.exception_in_file_connection = true; } //----------------------------------------------------------------------------- try { check = fc.exists(); System.out.println("File: " + fc.getURL() + " Exist? " + fc.exists()); if(check){ //----------------------------------------------------------------------------- fc.delete(); fc.close(); System.out.println("First check = " + check); return check; //----------------------------------------------------------------------------- }else{ //----------------------------------------------------------------------------- if(! fc.exists()){ fc.create(); } //System.out.println("********* Try To Create the file anyway ***************"); check = fc.exists(); //System.out.println("****** Check Again For The existense of Filename ******"); //----------------------------------------------------------------------------- if(check){ fc.close(); System.out.println("Second check = " + check); return check;} //----------------------------------------------------------------------------- }//else //----------------------------------------------------------------------------- }catch (IllegalModeException in) { System.out.println("IllegalModeException in fcopen dir: " + in); }catch (IOException in) { System.out.println("IOException in fcopen dir: " + in); }catch (Exception in) { System.out.println("Exception in fcopen dir: " + in); parent.exception_in_file_connection = true; } /*---------------------------------------------------------------------------*/ System.out.println(""); System.out.println(" *******************************************************"); System.out.println(" ****************** fcopen end *************************"); System.out.println(" *******************************************************"); System.out.println(""); /*---------------------------------------------------------------------------*/ // parent.List_Exceptions(); return check; //----------------------------------------------------------------------------- } /*****************************************************************************/ /*****************************************************************************/ >>>>>>>>>>>>>>>>> The code for fcopen END <<<<<<<<<<<<<<<<< ******************************************************* ****************** fcopen begin *********************** ******************************************************* File(url): file:///a:/m2m/g24.log File: file:///a:/m2m/g24.log Exist? false Second check = true ******************************************************* ****************** fcopen begin *********************** ******************************************************* File(url): file:///A:/m2m/g24.log File: file:///A:/m2m/g24.log Exist? true First check = true ******************************************************* ******************************************************* ************* Walking_The_File_Tree Begin ************* Walking_The_File_Tree: a:/ is a dir Walking_The_File_Tree: A:/ is a dir ************* Walking_The_File_Tree End *************** ******************************************************* ******************************************************* Checking files Files is OK ======================================================== =============== FileConnections END ==================== ========================================================