in local repo, make relative links to the index.html page

This should make the local repo files portable, like if the app gets
moved to the SD card or things like that.
This commit is contained in:
Hans-Christoph Steiner 2014-05-15 21:45:12 -04:00
parent 54283b71fd
commit 7ca966be05
2 changed files with 5 additions and 5 deletions

View File

@ -118,7 +118,7 @@ public final class Utils {
try { try {
Process sh = Runtime.getRuntime().exec("sh"); Process sh = Runtime.getRuntime().exec("sh");
OutputStream out = sh.getOutputStream(); OutputStream out = sh.getOutputStream();
String command = "/system/bin/ln -s " + inFile.getAbsolutePath() + " " + outFile String command = "/system/bin/ln -s " + inFile + " " + outFile
+ "\nexit\n"; + "\nexit\n";
out.write(command.getBytes("ASCII")); out.write(command.getBytes("ASCII"));

View File

@ -125,10 +125,10 @@ public class LocalRepoManager {
// the user will always find the bootstrap page. // the user will always find the bootstrap page.
File fdroidDirIndex = new File(fdroidDir, "index.html"); File fdroidDirIndex = new File(fdroidDir, "index.html");
fdroidDirIndex.delete(); fdroidDirIndex.delete();
Utils.symlinkOrCopyFile(indexHtml, fdroidDirIndex); Utils.symlinkOrCopyFile(new File("../index.html"), fdroidDirIndex);
File repoDirIndex = new File(repoDir, "index.html"); File repoDirIndex = new File(repoDir, "index.html");
repoDirIndex.delete(); repoDirIndex.delete();
Utils.symlinkOrCopyFile(indexHtml, repoDirIndex); Utils.symlinkOrCopyFile(new File("../../index.html"), repoDirIndex);
// add in /FDROID/REPO to support bad QR Scanner apps // add in /FDROID/REPO to support bad QR Scanner apps
File fdroidCAPS = new File(fdroidDir.getParentFile(), "FDROID"); File fdroidCAPS = new File(fdroidDir.getParentFile(), "FDROID");
fdroidCAPS.mkdir(); fdroidCAPS.mkdir();
@ -136,10 +136,10 @@ public class LocalRepoManager {
repoCAPS.mkdir(); repoCAPS.mkdir();
File fdroidCAPSIndex = new File(fdroidCAPS, "index.html"); File fdroidCAPSIndex = new File(fdroidCAPS, "index.html");
fdroidCAPSIndex.delete(); fdroidCAPSIndex.delete();
Utils.symlinkOrCopyFile(indexHtml, fdroidCAPSIndex); Utils.symlinkOrCopyFile(new File("../index.html"), fdroidCAPSIndex);
File repoCAPSIndex = new File(repoCAPS, "index.html"); File repoCAPSIndex = new File(repoCAPS, "index.html");
repoCAPSIndex.delete(); repoCAPSIndex.delete();
Utils.symlinkOrCopyFile(indexHtml, repoCAPSIndex); Utils.symlinkOrCopyFile(new File("../../index.html"), repoCAPSIndex);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }