Skip to content

Commit 35715fc

Browse files
author
jantje
committed
trying different locations for git repositories
1 parent 7ba400f commit 35715fc

File tree

1 file changed

+35
-5
lines changed

1 file changed

+35
-5
lines changed

io.sloeber.tests/src/io/sloeber/core/Shared.java

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class Shared {
2626
private static String jantjesVirtualLinuxMachine = "/home/jantje/programs/arduino-1.8.0/hardware/teensy";
2727

2828
public static String getTeensyPlatform() {
29-
switch ( Other.getSystemHash()) {
29+
switch (Other.getSystemHash()) {
3030
case "1248215851":
3131
return jantjesWindowsMachine;
3232
case "still need to gett the key":
@@ -74,18 +74,48 @@ public static IPath getTemplateFolder(String templateName) {
7474

7575
if (Platform.getOS().equals(Platform.OS_WIN32)) {
7676
if (gitHome == null) {
77-
System.err.println("Git HOME envvar is not define. Using default value");
7877
gitHome = System.getenv("HOMEDRIVE") + System.getenv("HOMEPATH");
7978
}
80-
gitHome += "/git";
8179
} else {
8280
if (gitHome == null) {
8381
System.err.println("Git HOME envvar is not define. Using default value");
8482
gitHome = "~";
8583
}
86-
gitHome += "/.git";
84+
85+
}
86+
Path path = new Path(gitHome + "/git/arduino-eclipse-plugin/io.sloeber.tests/src/templates/" + templateName);
87+
if (path.toFile().exists()) {
88+
return path;
89+
}
90+
path = new Path(gitHome + "/.git/arduino-eclipse-plugin/io.sloeber.tests/src/templates/" + templateName);
91+
if (path.toFile().exists()) {
92+
return path;
93+
}
94+
path = new Path(gitHome + "/git/Sloeber/arduino-eclipse-plugin/io.sloeber.tests/src/templates/" + templateName);
95+
if (path.toFile().exists()) {
96+
return path;
97+
}
98+
path = new Path(
99+
gitHome + "/.git/Sloeber/arduino-eclipse-plugin/io.sloeber.tests/src/templates/" + templateName);
100+
if (path.toFile().exists()) {
101+
return path;
102+
}
103+
path = new Path(gitHome + "/Sloeber/arduino-eclipse-plugin/io.sloeber.tests/src/templates/" + templateName);
104+
if (path.toFile().exists()) {
105+
return path;
106+
}
107+
path = new Path(
108+
gitHome + "/Sloeber/arduino-eclipse-plugin/io.sloeber.tests/src/templates/" + templateName);
109+
if (path.toFile().exists()) {
110+
return path;
87111
}
88-
Path path = new Path(gitHome + "/arduino-eclipse-plugin/io.sloeber.tests/src/templates/" + templateName);
112+
System.err.println("Failed to find templates in git repository. Checked following locations");
113+
System.err.println("->"+gitHome + "/git/arduino-eclipse-plugin/io.sloeber.tests/src/templates/" + templateName);
114+
System.err.println("->"+gitHome + "/.git/arduino-eclipse-plugin/io.sloeber.tests/src/templates/" + templateName);
115+
System.err.println("->"+gitHome + "/git/Sloeber/arduino-eclipse-plugin/io.sloeber.tests/src/templates/" + templateName);
116+
System.err.println("->"+gitHome + "/.git/Sloeber/arduino-eclipse-plugin/io.sloeber.tests/src/templates/" + templateName);
117+
System.err.println("->"+gitHome + "/Sloeber/arduino-eclipse-plugin/io.sloeber.tests/src/templates/" + templateName);
118+
System.err.println("->"+gitHome + "/Sloeber/arduino-eclipse-plugin/io.sloeber.tests/src/templates/" + templateName);
89119
return path;
90120
}
91121

0 commit comments

Comments
 (0)