Skip to content

Commit

Permalink
Make blaze -i overwrite existing files (to make updating easier)
Browse files Browse the repository at this point in the history
  • Loading branch information
jjlauer committed Nov 4, 2024
1 parent 62cb38b commit 7276a4b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,11 @@
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class InstallHelper {

static public List<Path> installBlazeBinaries(Path installDir) throws MessageOnlyException {
static public List<Path> installBlazeBinaries(Path installDir) throws MessageOnlyException, IOException {
if (Files.notExists(installDir)) {
throw new MessageOnlyException("Install directory " + installDir + " does not exist");
}
Expand Down Expand Up @@ -63,17 +62,18 @@ static public List<Path> installBlazeBinaries(Path installDir) throws MessageOnl
return installedFiles;
}

static private void installResource(String resourceName, Path targetFile) throws MessageOnlyException {
static private void installResource(String resourceName, Path targetFile) throws MessageOnlyException, IOException {
String fileName = targetFile.getFileName().toString();
InputStream is = Blaze.class.getResourceAsStream(resourceName);

if (is == null) {
throw new MessageOnlyException("Unable to find resource for " + resourceName);
}

if (Files.exists(targetFile)) {
throw new MessageOnlyException("File " + targetFile + " already exists (delete first then try again)");
}
/*if (Files.exists(targetFile)) {
// we should just delete the file, so it can be replaced
//throw new MessageOnlyException("File " + targetFile + " already exists (delete first then try again)");
}*/

try {
Files.copy(is, targetFile, StandardCopyOption.REPLACE_EXISTING);
Expand Down
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

<properties>
<java.version>1.8</java.version>
<javadoc.skip>true</javadoc.skip>
<!--<netbeans.compile.on.save>none</netbeans.compile.on.save>-->
<!-- workaround travis ci maven version requirement -->
<maven.enforce.version>3.2.5</maven.enforce.version>
Expand Down

0 comments on commit 7276a4b

Please sign in to comment.