MCPcopy
hub / github.com/arduino/Arduino / checkPath

Method checkPath

arduino-core/src/processing/app/windows/Platform.java:82–111  ·  view source on GitHub ↗

Remove extra quotes, slashes, and garbage from the Windows PATH.

()

Source from the content-addressed store, hash-verified

80 * Remove extra quotes, slashes, and garbage from the Windows PATH.
81 */
82 protected void checkPath() {
83 String path = System.getProperty("java.library.path");
84 String[] pieces = PApplet.split(path, File.pathSeparatorChar);
85 String[] legit = new String[pieces.length];
86 int legitCount = 0;
87 for (String item : pieces) {
88 if (item.startsWith("\"")) {
89 item = item.substring(1);
90 }
91 if (item.endsWith("\"")) {
92 item = item.substring(0, item.length() - 1);
93 }
94 if (item.endsWith(File.separator)) {
95 item = item.substring(0, item.length() - File.separator.length());
96 }
97 File directory = new File(item);
98 if (!directory.exists()) {
99 continue;
100 }
101 if (item.trim().length() == 0) {
102 continue;
103 }
104 legit[legitCount++] = item;
105 }
106 legit = PApplet.subset(legit, 0, legitCount);
107 String newPath = PApplet.join(legit, File.pathSeparator);
108 if (!newPath.equals(path)) {
109 System.setProperty("java.library.path", newPath);
110 }
111 }
112
113 @Override
114 public File getSettingsFolder() {

Callers 1

initMethod · 0.95

Calls 5

splitMethod · 0.95
subsetMethod · 0.95
joinMethod · 0.95
existsMethod · 0.45
equalsMethod · 0.45

Tested by

no test coverage detected