Skip to content

Commit ddc6e5b

Browse files
committed
Removed some code to investigate #301 #302
1 parent 51d7984 commit ddc6e5b

File tree

1 file changed

+53
-24
lines changed

1 file changed

+53
-24
lines changed

it.baeyens.arduino.core/src/it/baeyens/arduino/tools/ArduinoHelpers.java

Lines changed: 53 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
import java.io.InputStream;
1414
import java.io.InputStreamReader;
1515
import java.net.URI;
16-
import java.net.URISyntaxException;
17-
import java.net.URL;
1816
import java.util.ArrayList;
1917
import java.util.Calendar;
2018
import java.util.Date;
@@ -56,7 +54,6 @@
5654
import org.eclipse.core.resources.IWorkspace;
5755
import org.eclipse.core.resources.ResourcesPlugin;
5856
import org.eclipse.core.runtime.CoreException;
59-
import org.eclipse.core.runtime.FileLocator;
6057
import org.eclipse.core.runtime.IPath;
6158
import org.eclipse.core.runtime.IProgressMonitor;
6259
import org.eclipse.core.runtime.IStatus;
@@ -67,7 +64,6 @@
6764
import org.eclipse.ui.console.IConsole;
6865
import org.eclipse.ui.console.IConsoleManager;
6966
import org.eclipse.ui.console.MessageConsole;
70-
import org.osgi.framework.Bundle;
7167

7268
/**
7369
* ArduinoHelpers is a static class containing general purpose functions
@@ -771,22 +767,55 @@ public static void setTheEnvironmentVariables(IProject project, ICConfigurationD
771767
ArduinoInstancePreferences.getLastUsedBoardsFile()));
772768
IPath localPlatformFilename = new Path(Common.getBuildEnvironmentVariable(confDesc, ArduinoConst.ENV_KEY_JANTJE_PLATFORM_FILE, ""));
773769

774-
Bundle bundle = Platform.getBundle(ArduinoConst.CORE_PLUGIN_ID);
775-
URL fileURL = bundle.getEntry("config/arduino_eclipse_plugin.txt");
776-
File file = null;
777-
try {
778-
file = new File(FileLocator.resolve(fileURL).toURI());
779-
} catch (URISyntaxException e1) {
780-
e1.printStackTrace();
781-
} catch (IOException e1) {
782-
e1.printStackTrace();
783-
}
784-
if (file == null) {
785-
Common.log(new Status(IStatus.ERROR, ArduinoConst.CORE_PLUGIN_ID,
786-
"Your setup has gotten corruptes. Missing config/arduino_eclipse_plugin.txt file."));
787-
return;
788-
}
789-
IPath arduinoEclipsePluginFile = new Path(file.getAbsolutePath());
770+
/*
771+
* Trying to find the file in the plugin as described here :http://blog.vogella.com/2010/07/06/reading-resources-from-plugin/
772+
*/
773+
// Bundle bundle = Platform.getBundle(ArduinoConst.CORE_PLUGIN_ID);
774+
// URL fileURL = bundle.getEntry("config/arduino_eclipse_plugin.txt");
775+
// File file = null;
776+
// try {
777+
// file = new File(FileLocator.resolve(fileURL).toURI());
778+
// } catch (URISyntaxException e1) {
779+
// e1.printStackTrace();
780+
// } catch (IOException e1) {
781+
// e1.printStackTrace();
782+
// }
783+
// if (file == null) {
784+
// Common.log(new Status(IStatus.ERROR, ArduinoConst.CORE_PLUGIN_ID,
785+
// "Your setup has gotten corrupt. Missing config/arduino_eclipse_plugin.txt file."));
786+
// return;
787+
// }
788+
// IPath arduinoEclipsePluginFile = new Path(file.getAbsolutePath());
789+
790+
/*
791+
* try the second method as the first method fails
792+
*/
793+
// URL url;
794+
// try {
795+
// url = new URL("platform:/plugin/it.baeyens.arduino.core/config/arduino_eclipse_plugin.txt");
796+
// } catch (MalformedURLException e) {
797+
// // TODO Auto-generated catch block
798+
// e.printStackTrace();
799+
// return;
800+
// }
801+
// File file = null;
802+
// try {
803+
// URL resolved_url = FileLocator.resolve(url);
804+
// URI resolverdURI = resolved_url.toURI();
805+
// file = new File(resolverdURI);
806+
// } catch (URISyntaxException e1) {
807+
// e1.printStackTrace();
808+
// } catch (IOException e1) {
809+
// e1.printStackTrace();
810+
// } catch (Exception e1) {
811+
// e1.printStackTrace();
812+
// }
813+
// if (file == null) {
814+
// Common.log(new Status(IStatus.ERROR, ArduinoConst.CORE_PLUGIN_ID,
815+
// "Your setup has gotten corrupt. Missing config/arduino_eclipse_plugin.txt file."));
816+
// return;
817+
// }
818+
// IPath arduinoEclipsePluginFile = new Path(file.getAbsolutePath());
790819

791820
String boardID = Common.getBuildEnvironmentVariable(confDesc, ArduinoConst.ENV_KEY_JANTJE_BOARD_ID, "");
792821
String architecture = Common.getBuildEnvironmentVariable(confDesc, ArduinoConst.ENV_KEY_JANTJE_ARCITECTURE_ID, "");
@@ -828,10 +857,10 @@ public static void setTheEnvironmentVariables(IProject project, ICConfigurationD
828857
setTheEnvironmentVariablesAddtheBoardsTxt(contribEnv, confDesc, boardsFile, boardID, true);
829858

830859
// also process the file as part of the plugin
831-
if (arduinoEclipsePluginFile.toFile().exists()) {
832-
ArduinoBoards myBoardsFile = new ArduinoBoards(arduinoEclipsePluginFile.toOSString());
833-
setTheEnvironmentVariablesAddtheBoardsTxt(contribEnv, confDesc, myBoardsFile, boardID, false);
834-
}
860+
// if (arduinoEclipsePluginFile.toFile().exists()) {
861+
// ArduinoBoards myBoardsFile = new ArduinoBoards(arduinoEclipsePluginFile.toOSString());
862+
// setTheEnvironmentVariablesAddtheBoardsTxt(contribEnv, confDesc, myBoardsFile, boardID, false);
863+
// }
835864

836865
// Do some post processing
837866
setTheEnvironmentVariablesPostProcessing(contribEnv, confDesc);

0 commit comments

Comments
 (0)