mirror of
https://github.com/packwiz/packwiz-installer.git
synced 2025-04-20 05:26: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);
|
||||
}
|
||||
|
||||
// When successfully updated
|
||||
// TODO: update MMC params, java args etc
|
||||
|
||||
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())) {
|
||||
gson.toJson(manifest, writer);
|
||||
} catch (IOException e) {
|
||||
@ -271,6 +270,13 @@ public class UpdateManager {
|
||||
} 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 {
|
||||
Hash hash;
|
||||
String fileHashFormat;
|
||||
|
@ -26,10 +26,8 @@ public class IndexFile {
|
||||
@SerializedName("hash-format")
|
||||
public String hashFormat;
|
||||
public String hash;
|
||||
// TODO: implement
|
||||
public String alias;
|
||||
public URI alias;
|
||||
public boolean metafile;
|
||||
// TODO: implement
|
||||
public boolean preserve;
|
||||
|
||||
public transient ModFile linkedFile;
|
||||
@ -96,6 +94,9 @@ public class IndexFile {
|
||||
}
|
||||
|
||||
public URI getDestURI() {
|
||||
if (alias != null) {
|
||||
return alias;
|
||||
}
|
||||
if (metafile && linkedFile != null) {
|
||||
// TODO: URIs are bad
|
||||
return file.resolve(linkedFile.filename.replace(" ", "%20"));
|
||||
|
Loading…
x
Reference in New Issue
Block a user