@@ -2128,21 +2128,10 @@ protected boolean handleOpenInternal(File file) {
2128
2128
// check to make sure that this .pde file is
2129
2129
// in a folder of the same name
2130
2130
String fileName = file .getName ();
2131
- File parent = file .getParentFile ();
2132
- String parentName = parent .getName ();
2133
- String pdeName = parentName + ".pde" ;
2134
- File altPdeFile = new File (parent , pdeName );
2135
- String inoName = parentName + ".ino" ;
2136
- File altInoFile = new File (parent , inoName );
2137
-
2138
- if (pdeName .equals (fileName ) || inoName .equals (fileName )) {
2131
+
2132
+ if (SketchData .checkSketchFile (file )) {
2139
2133
// no beef with this guy
2140
2134
2141
- } else if (altPdeFile .exists ()) {
2142
- // user selected a .java from the same sketch, but open the .pde instead
2143
- file = altPdeFile ;
2144
- } else if (altInoFile .exists ()) {
2145
- file = altInoFile ;
2146
2135
} else if (!fileName .endsWith (".ino" ) && !fileName .endsWith (".pde" )) {
2147
2136
Base .showWarning (_ ("Bad file selected" ),
2148
2137
_ ("Arduino can only open its own sketches\n " +
@@ -2154,13 +2143,11 @@ protected boolean handleOpenInternal(File file) {
2154
2143
fileName .substring (0 , fileName .length () - 4 );
2155
2144
2156
2145
Object [] options = { _ ("OK" ), _ ("Cancel" ) };
2157
- String prompt = I18n .format (
2158
- _ ("The file \" {0}\" needs to be inside\n " +
2159
- "a sketch folder named \" {1}\" .\n " +
2160
- "Create this folder, move the file, and continue?" ),
2161
- fileName ,
2162
- properParent
2163
- );
2146
+ String prompt = I18n .format (_ ("The file \" {0}\" needs to be inside\n " +
2147
+ "a sketch folder named \" {1}\" .\n " +
2148
+ "Create this folder, move the file, and continue?" ),
2149
+ fileName ,
2150
+ properParent );
2164
2151
2165
2152
int result = JOptionPane .showOptionDialog (this ,
2166
2153
prompt ,
0 commit comments