From 4976e523899fbce53bddb1e3e34b14aaeb42baf7 Mon Sep 17 00:00:00 2001
From: zzz <zzz@mail.i2p>
Date: Sat, 20 Apr 2013 18:53:01 +0000
Subject: [PATCH] Pluck of 40d650b134e48bdb0bb636227381c22217365c47 *
 WorkingDir: Correctly strip DOS line endings while migrating,              
 to fix eepsite location on 0.9.5 Windows installs (ticket #919)

applied changes from cc74155815c98674b74cd7d9abb59704005d6b85
             through 40d650b134e48bdb0bb636227381c22217365c47
---
 router/java/src/net/i2p/router/startup/WorkingDir.java | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/router/java/src/net/i2p/router/startup/WorkingDir.java b/router/java/src/net/i2p/router/startup/WorkingDir.java
index cdec547dfe..eafaa19b81 100644
--- a/router/java/src/net/i2p/router/startup/WorkingDir.java
+++ b/router/java/src/net/i2p/router/startup/WorkingDir.java
@@ -294,6 +294,9 @@ public class WorkingDir {
             String s = null;
             boolean isDaemon = DAEMON_USER.equals(System.getProperty("user.name"));
             while ((s = DataHelper.readLine(in)) != null) {
+                // readLine() doesn't strip \r
+                if (s.endsWith("\r"))
+                    s = s.substring(0, s.length() - 1);
                 if (s.endsWith("=\"eepsite/jetty.xml\"")) {
                     s = s.replace("=\"eepsite/jetty.xml\"", "=\"" + todir.getAbsolutePath() +
                                                             File.separatorChar + "eepsite" +
@@ -333,6 +336,9 @@ public class WorkingDir {
             out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(new SecureFileOutputStream(newFile), "UTF-8")));
             String s = null;
             while ((s = DataHelper.readLine(in)) != null) {
+                // readLine() doesn't strip \r
+                if (s.endsWith("\r"))
+                    s = s.substring(0, s.length() - 1);
                 if (s.indexOf(oldString) >= 0) {
                     s = s.replace(oldString, newString);
                 }
-- 
GitLab