From 7ca966be052cb4b5efc59d168febacbdca9609c8 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Thu, 15 May 2014 21:45:12 -0400 Subject: [PATCH] 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. --- src/org/fdroid/fdroid/Utils.java | 2 +- src/org/fdroid/fdroid/localrepo/LocalRepoManager.java | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/org/fdroid/fdroid/Utils.java b/src/org/fdroid/fdroid/Utils.java index f071579a5..9b1f29ee3 100644 --- a/src/org/fdroid/fdroid/Utils.java +++ b/src/org/fdroid/fdroid/Utils.java @@ -118,7 +118,7 @@ public final class Utils { try { Process sh = Runtime.getRuntime().exec("sh"); OutputStream out = sh.getOutputStream(); - String command = "/system/bin/ln -s " + inFile.getAbsolutePath() + " " + outFile + String command = "/system/bin/ln -s " + inFile + " " + outFile + "\nexit\n"; out.write(command.getBytes("ASCII")); diff --git a/src/org/fdroid/fdroid/localrepo/LocalRepoManager.java b/src/org/fdroid/fdroid/localrepo/LocalRepoManager.java index 5b21235a2..a1d05ba7f 100644 --- a/src/org/fdroid/fdroid/localrepo/LocalRepoManager.java +++ b/src/org/fdroid/fdroid/localrepo/LocalRepoManager.java @@ -125,10 +125,10 @@ public class LocalRepoManager { // the user will always find the bootstrap page. File fdroidDirIndex = new File(fdroidDir, "index.html"); fdroidDirIndex.delete(); - Utils.symlinkOrCopyFile(indexHtml, fdroidDirIndex); + Utils.symlinkOrCopyFile(new File("../index.html"), fdroidDirIndex); File repoDirIndex = new File(repoDir, "index.html"); repoDirIndex.delete(); - Utils.symlinkOrCopyFile(indexHtml, repoDirIndex); + Utils.symlinkOrCopyFile(new File("../../index.html"), repoDirIndex); // add in /FDROID/REPO to support bad QR Scanner apps File fdroidCAPS = new File(fdroidDir.getParentFile(), "FDROID"); fdroidCAPS.mkdir(); @@ -136,10 +136,10 @@ public class LocalRepoManager { repoCAPS.mkdir(); File fdroidCAPSIndex = new File(fdroidCAPS, "index.html"); fdroidCAPSIndex.delete(); - Utils.symlinkOrCopyFile(indexHtml, fdroidCAPSIndex); + Utils.symlinkOrCopyFile(new File("../index.html"), fdroidCAPSIndex); File repoCAPSIndex = new File(repoCAPS, "index.html"); repoCAPSIndex.delete(); - Utils.symlinkOrCopyFile(indexHtml, repoCAPSIndex); + Utils.symlinkOrCopyFile(new File("../../index.html"), repoCAPSIndex); } catch (IOException e) { e.printStackTrace(); }