1
0
mirror of https://github.com/SKCraft/Launcher.git synced 2024-11-24 12:16:28 +01:00

Correct location/to mix-up

If .url.txt is used, the manifest file should specify that as the download location, not the local "to" location
This commit is contained in:
Antony Derham 2015-03-12 14:37:26 +00:00
parent 0d8784992b
commit 951a854384

View File

@ -58,21 +58,22 @@ public class ClientFileCollector extends DirectoryWalker {
return;
}
// url.txt override file
File urlFile = new File(file.getAbsoluteFile().getParentFile(), file.getName() + URL_FILE_SUFFIX);
String to;
if (urlFile.exists()) {
to = Files.readFirstLine(urlFile, Charset.defaultCharset());
} else {
to = FilenameUtils.separatorsToUnix(FilenameUtils.normalize(relPath));
}
FileInstall entry = new FileInstall();
String hash = Files.hash(file, hf).toString();
String hashedPath = hash.substring(0, 2) + "/" + hash.substring(2, 4) + "/" + hash;
File destPath = new File(destDir, hashedPath);
String to = FilenameUtils.separatorsToUnix(FilenameUtils.normalize(relPath));
// url.txt override file
File urlFile = new File(file.getAbsoluteFile().getParentFile(), file.getName() + URL_FILE_SUFFIX);
String location;
if (urlFile.exists()) {
location = Files.readFirstLine(urlFile, Charset.defaultCharset());
} else {
location = hash.substring(0, 2) + "/" + hash.substring(2, 4) + "/" + hash;
}
File destPath = new File(destDir, location);
entry.setHash(hash);
entry.setLocation(hashedPath);
entry.setLocation(location);
entry.setTo(to);
entry.setSize(file.length());
applicator.apply(entry);