mirror of
https://github.com/packwiz/packwiz-installer.git
synced 2025-04-20 13:36:30 +02:00
Implement preserve and alias in index
This commit is contained in:
parent
12bf090895
commit
d1647764c4
@ -157,10 +157,9 @@ public class UpdateManager {
|
|||||||
ui.handleExceptionAndExit(e1);
|
ui.handleExceptionAndExit(e1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// When successfully updated
|
// TODO: update MMC params, java args etc
|
||||||
|
|
||||||
manifest.packFileHash = packFileSource.getHash();
|
manifest.packFileHash = packFileSource.getHash();
|
||||||
// update other hashes
|
|
||||||
// TODO: don't do this on failure?
|
|
||||||
try (Writer writer = new FileWriter(Paths.get(opts.packFolder, opts.manifestFile).toString())) {
|
try (Writer writer = new FileWriter(Paths.get(opts.packFolder, opts.manifestFile).toString())) {
|
||||||
gson.toJson(manifest, writer);
|
gson.toJson(manifest, writer);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@ -271,6 +270,13 @@ public class UpdateManager {
|
|||||||
} catch (Exception e) {}
|
} catch (Exception e) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Don't update files marked with preserve if they already exist on disk
|
||||||
|
if (f.preserve) {
|
||||||
|
if (Files.exists(Paths.get(opts.packFolder, f.getDestURI().toString()))) {
|
||||||
|
return dc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Hash hash;
|
Hash hash;
|
||||||
String fileHashFormat;
|
String fileHashFormat;
|
||||||
|
@ -26,10 +26,8 @@ public class IndexFile {
|
|||||||
@SerializedName("hash-format")
|
@SerializedName("hash-format")
|
||||||
public String hashFormat;
|
public String hashFormat;
|
||||||
public String hash;
|
public String hash;
|
||||||
// TODO: implement
|
public URI alias;
|
||||||
public String alias;
|
|
||||||
public boolean metafile;
|
public boolean metafile;
|
||||||
// TODO: implement
|
|
||||||
public boolean preserve;
|
public boolean preserve;
|
||||||
|
|
||||||
public transient ModFile linkedFile;
|
public transient ModFile linkedFile;
|
||||||
@ -96,6 +94,9 @@ public class IndexFile {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public URI getDestURI() {
|
public URI getDestURI() {
|
||||||
|
if (alias != null) {
|
||||||
|
return alias;
|
||||||
|
}
|
||||||
if (metafile && linkedFile != null) {
|
if (metafile && linkedFile != null) {
|
||||||
// TODO: URIs are bad
|
// TODO: URIs are bad
|
||||||
return file.resolve(linkedFile.filename.replace(" ", "%20"));
|
return file.resolve(linkedFile.filename.replace(" ", "%20"));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user