[freenet-cvs] r15786 - trunk/freenet/src/freenet/pluginmanager

bombe at freenetproject.org bombe at freenetproject.org
Tue Nov 13 23:32:04 UTC 2007


Author: bombe
Date: 2007-11-13 23:32:04 +0000 (Tue, 13 Nov 2007)
New Revision: 15786

Modified:
   trunk/freenet/src/freenet/pluginmanager/PluginManager.java
Log:
cache plugins in plugins/ directory relative to node dir, not to current dir

Modified: trunk/freenet/src/freenet/pluginmanager/PluginManager.java
===================================================================
--- trunk/freenet/src/freenet/pluginmanager/PluginManager.java	2007-11-13 23:05:53 UTC (rev 15785)
+++ trunk/freenet/src/freenet/pluginmanager/PluginManager.java	2007-11-13 23:32:04 UTC (rev 15786)
@@ -259,11 +259,12 @@
 			/* Windows, maybe? */
 			lastSlash = pluginSpecification.lastIndexOf('\\');
 		}
+		File pluginDirectory = new File(node.getNodeDir(), "plugins");
 		if (lastSlash == -1) {
 			/* it's an official plugin! */
-			pluginFile = new File("plugins", pluginSpecification + ".jar.url");
+			pluginFile = new File(pluginDirectory, pluginSpecification + ".jar.url");
 		} else {
-			pluginFile = new File("plugins", pluginSpecification.substring(lastSlash + 1));
+			pluginFile = new File(pluginDirectory, pluginSpecification.substring(lastSlash + 1));
 		}
 		if (pluginFile.exists()) {
 			pluginFile.delete();
@@ -426,11 +427,11 @@
 		/* check if name is a local file. */
 		File pluginFile = new File(name);
 		if (pluginFile.exists() && pluginFile.isFile()) {
-                        try {
-                            pluginUrl = pluginFile.toURI().toURL();
-                        } catch (MalformedURLException e) {
-                            throw new PluginNotFoundException("can not convert local path");
-                        }
+			try {
+				pluginUrl = pluginFile.toURI().toURL();
+			} catch (MalformedURLException e) {
+				throw new PluginNotFoundException("can not convert local path");
+			}
 		} else {
 			/* check if name contains a URL. */
 			try {
@@ -448,7 +449,7 @@
 		}
 
 		/* check for plugin directory. */
-		File pluginDirectory = new File("plugins");
+		File pluginDirectory = new File(node.getNodeDir(), "plugins");
 		if ((pluginDirectory.exists() && !pluginDirectory.isDirectory()) || (!pluginDirectory.exists() && !pluginDirectory.mkdirs())) {
 			Logger.error(this, "could not create plugin directory");
 			throw new PluginNotFoundException("could not create plugin directory");




More information about the cvs mailing list