Changeset fd4e57aa


Ignore:
Timestamp:
Jun 6, 2009 3:36:06 PM (11 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
290af4c1
Parents:
524a25e
Message:
  • Console:
    • More conversions to getBaseDir()
  • Router:
    • Improve installUpdates() error handling
  • BrowserLauncher?:
    • Use temp dir
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • apps/routerconsole/jsp/help.jsp

    r524a25e rfd4e57aa  
    185185<h2>Release history</h2>
    186186 <jsp:useBean class="net.i2p.router.web.ContentHelper" id="contenthelper" scope="request" />
    187  <jsp:setProperty name="contenthelper" property="page" value="history.txt" />
     187 <% File fpath = new java.io.File(net.i2p.I2PAppContext.getGlobalContext().getBaseDir(), "history.txt"); %>
     188 <jsp:setProperty name="contenthelper" property="page" value="<%=fpath.getAbsolutePath()%>" />
    188189 <jsp:setProperty name="contenthelper" property="maxLines" value="500" />
    189190 <jsp:setProperty name="contenthelper" property="startAtBeginning" value="true" />
  • apps/routerconsole/jsp/index.jsp

    r524a25e rfd4e57aa  
    2020<div class="news" id="news">
    2121 <jsp:useBean class="net.i2p.router.web.ContentHelper" id="newshelper" scope="request" />
    22  <jsp:setProperty name="newshelper" property="page" value="docs/news.xml" />
     22 <% File fpath = new java.io.File(net.i2p.I2PAppContext.getGlobalContext().getBaseDir(), "docs/news.xml"); %>
     23 <jsp:setProperty name="newshelper" property="page" value="<%=fpath.getAbsolutePath()%>" />
    2324 <jsp:setProperty name="newshelper" property="maxLines" value="300" />
    2425 <jsp:getProperty name="newshelper" property="content" />
     
    3132<div class="main" id="main">
    3233 <jsp:useBean class="net.i2p.router.web.ContentHelper" id="contenthelper" scope="request" />
    33  <jsp:setProperty name="contenthelper" property="page" value="docs/readme.html" />
     34 <% fpath = new java.io.File(net.i2p.I2PAppContext.getGlobalContext().getBaseDir(), "docs/readme.html"); %>
     35 <jsp:setProperty name="contenthelper" property="page" value="<%=fpath.getAbsolutePath()%>" />
    3436 <jsp:setProperty name="contenthelper" property="maxLines" value="300" />
    3537 <jsp:setProperty name="contenthelper" property="lang" value="<%=request.getParameter("lang")%>" />
  • apps/routerconsole/jsp/nav.jsp

    r524a25e rfd4e57aa  
    1515</div>
    1616<div class="toolbar">
    17  <% if (new File("docs/toolbar.html").exists()) { %>
     17 <% File path = new File(net.i2p.I2PAppContext.getGlobalContext().getBaseDir(), "docs/toolbar.html");
     18    if (path.exists()) { %>
    1819   <jsp:useBean class="net.i2p.router.web.ContentHelper" id="toolbarhelper" scope="request" />
    19    <jsp:setProperty name="toolbarhelper" property="page" value="docs/toolbar.html" />
     20   <jsp:setProperty name="toolbarhelper" property="page" value="<%=path.getAbsolutePath()%>" />
    2021   <jsp:setProperty name="toolbarhelper" property="maxLines" value="300" />
    2122   <jsp:getProperty name="toolbarhelper" property="content" />
  • apps/systray/java/src/net/i2p/apps/systray/UrlLauncher.java

    r524a25e rfd4e57aa  
    1818import java.net.URL;
    1919
     20import net.i2p.I2PAppContext;
    2021import net.i2p.util.ShellCommand;
    2122
     
    6970                BufferedReader bufferedReader = null;
    7071
    71                 _shellCommand.executeSilentAndWait("regedit /E browser.reg \"HKEY_CLASSES_ROOT\\http\\shell\\open\\command\"");
     72                File foo = new File(I2PAppContext.getGlobalContext().getTempDir(), "browser.reg");
     73                _shellCommand.executeSilentAndWait("regedit /E \"" + foo.getAbsolutePath() + "\" \"HKEY_CLASSES_ROOT\\http\\shell\\open\\command\"");
    7274
    7375                try {
    74                     bufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream("browser.reg"), "UTF-16"));
     76                    bufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream(foo), "UTF-16"));
    7577                    for (String line; (line = bufferedReader.readLine()) != null; ) {
    7678                        if (line.startsWith("@=")) {
     
    8789                        // No worries.
    8890                    }
    89                     new File("browser.reg").delete();
     91                    foo.delete();
    9092                } catch (Exception e) {
    9193                    // Defaults to IE.
  • build.xml

    r524a25e rfd4e57aa  
    361361        <copy file="build/sam.jar" todir="pkg-temp/lib/" />
    362362        <copy file="build/i2psnark.jar" todir="pkg-temp/lib" />
    363         <!-- include systray fixes in 0.6.5 -->
     363        <!-- include systray changes in 0.7.5 -->
    364364        <copy file="build/systray.jar" todir="pkg-temp/lib/" />
    365365        <copy file="build/susimail.war" todir="pkg-temp/webapps/" />
  • router/java/src/net/i2p/router/Router.java

    r524a25e rfd4e57aa  
    10771077     *
    10781078     * If we can't write to the base dir, complain.
     1079     * Note: _log not available here.
    10791080     */
    10801081    private void installUpdates() {
     
    10861087        }
    10871088        if (exists) {
     1089            // do a simple permissions test, if it fails leave the file in place and don't restart
    10881090            File test = new File(_context.getBaseDir(), "history.txt");
    1089             if ((!test.canWrite()) || (!_context.getBaseDir().canWrite())) {
    1090                 String msg = "ERROR: No write permissions on " + _context.getBaseDir() +
    1091                              " to extract software update file";
    1092                 System.out.println(msg);
    1093                 _log.log(Log.CRIT, msg);
     1091            if ((test.exists() && !test.canWrite()) || (!_context.getBaseDir().canWrite())) {
     1092                System.out.println("ERROR: No write permissions on " + _context.getBaseDir() +
     1093                                   " to extract software update file");
    10941094                // carry on
    10951095                return;
     
    11011101            else
    11021102                System.out.println("ERROR: Update failed!");
    1103             boolean deleted = updateFile.delete();
    1104             if (!deleted) {
    1105                 System.out.println("ERROR: Unable to delete the update file!");
    1106                 updateFile.deleteOnExit();
     1103            if (!ok) {
     1104                // we can't leave the file in place or we'll continually restart, so rename it
     1105                File bad = new File(_context.getRouterDir(), "BAD-" + UPDATE_FILE);
     1106                boolean renamed = updateFile.renameTo(bad);
     1107                if (renamed) {
     1108                    System.out.println("Moved update file to " + bad.getAbsolutePath());
     1109                } else {
     1110                    System.out.println("Deleting file " + updateFile.getAbsolutePath());
     1111                    ok = true;  // so it will be deleted
     1112                }
     1113            }
     1114            if (ok) {
     1115                boolean deleted = updateFile.delete();
     1116                if (!deleted) {
     1117                    System.out.println("ERROR: Unable to delete the update file!");
     1118                    updateFile.deleteOnExit();
     1119                }
    11071120            }
    11081121            if (System.getProperty("wrapper.version") != null)
Note: See TracChangeset for help on using the changeset viewer.