@@ -1754,46 +1754,15 @@ protected boolean handleOpenInternal(File sketchFile) {
17541754 } else {
17551755 String properParent = fileName .substring (0 , fileName .length () - 4 );
17561756
1757- Object [] options = {tr ("OK" ), tr ( "Cancel" ) };
1757+ Object [] options = {tr ("OK" )};
17581758 String prompt = I18n .format (tr ("The file \" {0}\" needs to be inside\n " +
1759- "a sketch folder named \" {1}\" .\n " +
1760- "Create this folder, move the file, and continue?" ),
1759+ "a sketch folder named \" {1}\" .\n " ),
17611760 fileName ,
17621761 properParent );
17631762
1764- int result = JOptionPane .showOptionDialog (this , prompt , tr ("Moving" ), JOptionPane .YES_NO_OPTION , JOptionPane .QUESTION_MESSAGE , null , options , options [0 ]);
1765-
1766- if (result != JOptionPane .YES_OPTION ) {
1767- return false ;
1768- }
1769-
1770- // create properly named folder
1771- File properFolder = new File (sketchFile .getParent (), properParent );
1772- if (properFolder .exists ()) {
1773- Base .showWarning (tr ("Error" ), I18n .format (tr ("A folder named \" {0}\" already exists. " +
1774- "Can't open sketch." ), properParent ), null );
1775- return false ;
1776- }
1777- if (!properFolder .mkdirs ()) {
1778- //throw new IOException("Couldn't create sketch folder");
1779- Base .showWarning (tr ("Error" ), tr ("Could not create the sketch folder." ), null );
1780- return false ;
1781- }
1782- // copy the sketch inside
1783- File properPdeFile = new File (properFolder , sketchFile .getName ());
1784- try {
1785- FileUtils .copy (new File (sketchFile .getParent ()), properFolder );
1786- } catch (IOException e ) {
1787- Base .showWarning (tr ("Error" ), tr ("Could not copy to a proper location." ), e );
1788- return false ;
1789- }
1790-
1791- // remove the original file, so user doesn't get confused
1792- sketchFile .delete ();
1793-
1794- // update with the new path
1795- file = properPdeFile ;
1763+ int result = JOptionPane .showOptionDialog (this , prompt , tr ("Error" ), JOptionPane .OK_OPTION , JOptionPane .ERROR_MESSAGE , null , options , options [0 ]);
17961764
1765+ return false ;
17971766 }
17981767 }
17991768
0 commit comments