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

Merge pull request #48 from Ant59/patch-1

Fix .url.txt not generating correct manifest files.
This commit is contained in:
sk89q 2015-03-20 15:00:26 -07:00
commit 629552acb6

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);