Skip to content

Commit d4c9bd3

Browse files
author
jantje
committed
1 parent b69ae45 commit d4c9bd3

File tree

1 file changed

+49
-46
lines changed
  • io.sloeber.core/src/io/sloeber/core/managers

1 file changed

+49
-46
lines changed

io.sloeber.core/src/io/sloeber/core/managers/Tool.java

+49-46
Original file line numberDiff line numberDiff line change
@@ -16,69 +16,72 @@
1616
import org.eclipse.core.runtime.Status;
1717

1818
import io.sloeber.common.ConfigurationPreferences;
19+
import io.sloeber.common.Const;
1920
import io.sloeber.core.Activator;
2021

2122
public class Tool {
2223

23-
private String name;
24-
private String version;
25-
private List<ToolSystem> systems;
24+
private static final String TOOLS = "tools";
25+
private String name;
26+
private String version;
27+
private List<ToolSystem> systems;
2628

27-
private transient Package pkg;
29+
private transient Package pkg;
2830

29-
public void setOwner(Package pkg) {
30-
this.pkg = pkg;
31-
for (ToolSystem system : this.systems) {
32-
system.setOwner(this);
31+
public void setOwner(Package pkg) {
32+
this.pkg = pkg;
33+
for (ToolSystem system : this.systems) {
34+
system.setOwner(this);
35+
}
3336
}
34-
}
3537

36-
public Package getPackage() {
37-
return this.pkg;
38-
}
38+
public Package getPackage() {
39+
return this.pkg;
40+
}
3941

40-
public String getName() {
41-
return this.name;
42-
}
42+
public String getName() {
43+
return this.name;
44+
}
4345

44-
public String getVersion() {
45-
return this.version;
46-
}
46+
public String getVersion() {
47+
return this.version;
48+
}
4749

48-
public List<ToolSystem> getSystems() {
49-
return this.systems;
50-
}
50+
public List<ToolSystem> getSystems() {
51+
return this.systems;
52+
}
5153

52-
public Path getInstallPath() {
53-
return Paths.get(ConfigurationPreferences.getInstallationPath().append("tools").append(this.pkg.getName()) //$NON-NLS-1$
54-
.append(this.name).append(this.version).toString());
55-
}
54+
public Path getInstallPath() {
55+
return Paths.get(ConfigurationPreferences.getInstallationPath().append(Const.PACKAGES_FOLDER_NAME)
56+
.append(this.pkg.getName()).append(TOOLS).append(this.name).append(this.version).toString());
5657

57-
public boolean isInstalled() {
58-
return getInstallPath().toFile().exists();
59-
}
58+
}
6059

61-
public IStatus install(IProgressMonitor monitor) {
62-
if (isInstalled()) {
63-
return Status.OK_STATUS;
60+
public boolean isInstalled() {
61+
return getInstallPath().toFile().exists();
6462
}
6563

66-
for (ToolSystem system : this.systems) {
67-
if (system.isApplicable()) {
68-
return system.install(monitor);
69-
}
64+
public IStatus install(IProgressMonitor monitor) {
65+
if (isInstalled()) {
66+
return Status.OK_STATUS;
67+
}
68+
69+
for (ToolSystem system : this.systems) {
70+
if (system.isApplicable()) {
71+
return system.install(monitor);
72+
}
73+
}
74+
75+
// No valid system
76+
return new Status(IStatus.ERROR, Activator.getId(), Messages.Tool_no_valid_system + this.name);
7077
}
7178

72-
// No valid system
73-
return new Status(IStatus.ERROR, Activator.getId(), Messages.Tool_no_valid_system + this.name);
74-
}
75-
76-
// public Properties getToolProperties() {
77-
// Properties properties = new Properties();
78-
// properties.put("runtime.tools." + name + ".path",
79-
// ArduinoBuildConfiguration.pathString(getInstallPath())); // $NON-NLS-1$
80-
// //$NON-NLS-2$
81-
// return properties;
82-
// }
79+
// public Properties getToolProperties() {
80+
// Properties properties = new Properties();
81+
// properties.put("runtime.tools." + name + ".path",
82+
// ArduinoBuildConfiguration.pathString(getInstallPath())); // $NON-NLS-1$
83+
// //$NON-NLS-2$
84+
// return properties;
85+
// }
8386

8487
}

0 commit comments

Comments
 (0)