Skip to content

Commit a6c2a8b

Browse files
committed
Default to not overwriting existing files. Improve console output.
1 parent 99bac98 commit a6c2a8b

2 files changed

Lines changed: 15 additions & 5 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Short name | Long name | Description | Argument
2525
`-h` | `--headers` | Flags the C++ headers for install
2626
`-n` | `--natives` | Flags the C++ native libraries for install
2727
| | `--all` | Installs all OpenCV artifacts
28-
| | `--no-overwrite` | Do not overwrite already installed files
28+
| `-o` | `--overwrite` | Overwrite already installed files
2929
| | `--platform` | Download artifacts for a specific platform. They will be located in `./install` | The platform to download artifacts for
3030

3131
#### Options for `platform`

src/main/java/edu/wpi/first/wpilib/opencv/installer/Installer.java

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public class Installer {
2929
private static final String mavenLocal = userHome + "/.m2/repository";
3030
private static final Path tmpDir;
3131
private static final Path unzippedDir;
32-
private static boolean overwrite = true;
32+
private static boolean overwrite = false;
3333

3434
static {
3535
try {
@@ -71,7 +71,7 @@ public static void main(String[] args) throws ParseException {
7171
addOption("help", "help", false, "Prints this help message");
7272
addOption("a", "all", false, "Installs all artifacts");
7373
addOption("v", "version", true, "Set the version of OpenCV to install");
74-
addOption(null, "no-overwrite", false, "Don't overwrite existing files when installing");
74+
addOption("o", "overwrite", false, "Overwrite existing files when installing");
7575
addOption(null, "platform", true, "Install artifacts for a specific platform");
7676
}};
7777
CommandLine parsedArgs = p.parse(options, args);
@@ -87,9 +87,8 @@ public static void main(String[] args) throws ParseException {
8787
setPlatform(Platform.valueOf(parsedArgs.getOptionValue("platform")));
8888
}
8989
setVersion(parsedArgs.getOptionValue("version"));
90-
overwrite = !parsedArgs.hasOption("no-overwrite");
90+
overwrite = parsedArgs.hasOption("overwrite");
9191
System.out.println("Installing specified OpenCV components");
92-
System.out.println("======================================");
9392
if (parsedArgs.hasOption("java") || parsedArgs.hasOption("all")) {
9493
installJava();
9594
}
@@ -111,6 +110,9 @@ public static void main(String[] args) throws ParseException {
111110
* Sets a specific platform to install. Artifacts will be downloaded into the working directory and will need to be
112111
* manually installed.
113112
*
113+
* <p><strong>The platform is auto-detected when this class is loaded</strong>; this method should only be used
114+
* when downloading artifacts for a different operating system or architecture.</p>
115+
*
114116
* @param p the platform to get the artifacts for
115117
*/
116118
public static void setPlatform(Platform p) {
@@ -137,31 +139,39 @@ private static void calculateVersion() {
137139
* Downloads the Java API jar.
138140
*/
139141
public static void installJava() {
142+
System.out.println("====================");
140143
System.out.println("Installing Java");
144+
System.out.println("====================");
141145
install(ArtifactType.JAVA);
142146
}
143147

144148
/**
145149
* Installs the JNI bindings.
146150
*/
147151
public static void installJni() {
152+
System.out.println("====================");
148153
System.out.println("Installing JNI");
154+
System.out.println("====================");
149155
install(ArtifactType.JNI);
150156
}
151157

152158
/**
153159
* Installs the C++ headers.
154160
*/
155161
public static void installHeaders() {
162+
System.out.println("====================");
156163
System.out.println("Installing headers");
164+
System.out.println("====================");
157165
install(ArtifactType.HEADERS);
158166
}
159167

160168
/**
161169
* Installs the C++ native libraries.
162170
*/
163171
public static void installNatives() {
172+
System.out.println("====================");
164173
System.out.println("Installing natives");
174+
System.out.println("====================");
165175
install(ArtifactType.NATIVES);
166176
}
167177

0 commit comments

Comments
 (0)