aboutsummaryrefslogtreecommitdiffstats
path: root/plugin/icedteanp
diff options
context:
space:
mode:
authorJiri Vanek <[email protected]>2013-03-20 15:35:22 +0100
committerJiri Vanek <[email protected]>2013-03-20 15:35:22 +0100
commit19c9316343de416d62833487a2f1cbcff77ca3e2 (patch)
tree28b1e151804f038a378080322235e74f09999551 /plugin/icedteanp
parent8e0eab00f7e16e4e3c3faeee148361743eb589c1 (diff)
All occurences of hardcoded paths to java repalced by call of functions
* plugin/icedteanp/IcedTeaNPPlugin.cc: (appletviewer_executable) renamed to (appletviewer_default_executable). (appletviewer_default_rtjar) new variable to keep default rt.jar path. (get_plugin_executable) and (string get_plugin_rt_jar) new functions, returniong the default variables for now.
Diffstat (limited to 'plugin/icedteanp')
-rw-r--r--plugin/icedteanp/IcedTeaNPPlugin.cc35
1 files changed, 24 insertions, 11 deletions
diff --git a/plugin/icedteanp/IcedTeaNPPlugin.cc b/plugin/icedteanp/IcedTeaNPPlugin.cc
index c3692ab..22765c3 100644
--- a/plugin/icedteanp/IcedTeaNPPlugin.cc
+++ b/plugin/icedteanp/IcedTeaNPPlugin.cc
@@ -43,6 +43,7 @@ exception statement from your version. */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <string>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
@@ -156,8 +157,9 @@ static NS_DEFINE_IID (kIPluginTagInfo2IID, NS_IPLUGINTAGINFO2_IID);
// Data directory for plugin.
static std::string data_directory;
-// Fully-qualified appletviewer executable.
-static const char* appletviewer_executable = ICEDTEA_WEB_JRE "/bin/java";
+// Fully-qualified appletviewer default executable and rt.jar
+static const char* appletviewer_default_executable = ICEDTEA_WEB_JRE "/bin/java";
+static const char* appletviewer_default_rtjar = ICEDTEA_WEB_JRE "/lib/rt.jar";
// Applet viewer input channel (needs to be static because it is used in plugin_in_pipe_callback)
static GIOChannel* in_from_appletviewer = NULL;
@@ -284,6 +286,16 @@ g_strcmp0(char *str1, char *str2)
#endif
+static std::string get_plugin_executable(){
+ return std::string (appletviewer_default_executable);
+
+}
+
+static std::string get_plugin_rt_jar(){
+ return std::string (appletviewer_default_rtjar);
+
+}
+
/*
* Find first member in GHashTable* depending on version of glib
@@ -1517,13 +1529,14 @@ plugin_filter_environment(void)
static NPError
plugin_test_appletviewer ()
{
- PLUGIN_DEBUG ("plugin_test_appletviewer: %s\n", appletviewer_executable);
+
+ PLUGIN_DEBUG ("plugin_test_appletviewer: %s\n", get_plugin_executable().c_str());
NPError error = NPERR_NO_ERROR;
gchar* command_line[3] = { NULL, NULL, NULL };
gchar** environment;
- command_line[0] = g_strdup (appletviewer_executable);
+ command_line[0] = g_strdup (get_plugin_executable().c_str());
command_line[1] = g_strdup("-version");
command_line[2] = NULL;
@@ -1570,7 +1583,7 @@ plugin_start_appletviewer (ITNPPluginData* data)
// Construct command line parameters
- command_line.push_back(appletviewer_executable);
+ command_line.push_back(get_plugin_executable());
//Add JVM args to command_line
for (int i = 0; i < jvm_args->size(); i++)
@@ -1581,7 +1594,7 @@ plugin_start_appletviewer (ITNPPluginData* data)
command_line.push_back(PLUGIN_BOOTCLASSPATH);
// set the classpath to avoid using the default (cwd).
command_line.push_back("-classpath");
- command_line.push_back(ICEDTEA_WEB_JRE "/lib/rt.jar");
+ command_line.push_back(get_plugin_rt_jar());
// Enable coverage agent if we are running instrumented plugin
#ifdef COVERAGE_AGENT
@@ -1652,10 +1665,10 @@ get_jvm_args()
gchar *output = NULL;
std::vector<std::string*>* tokenOutput = NULL;
- commands.push_back(appletviewer_executable);
+ commands.push_back(get_plugin_executable());
commands.push_back(PLUGIN_BOOTCLASSPATH);
commands.push_back("-classpath");
- commands.push_back(ICEDTEA_WEB_JRE "/lib/rt.jar");
+ commands.push_back(get_plugin_rt_jar());
commands.push_back("net.sourceforge.jnlp.controlpanel.CommandLine");
commands.push_back("get");
commands.push_back("deployment.plugin.jvm.arguments");
@@ -2175,11 +2188,11 @@ NP_Initialize (NPNetscapeFuncs* browserTable, NPPluginFuncs* pluginTable)
}
// Set appletviewer_executable.
- PLUGIN_DEBUG("Executing java at %s\n", appletviewer_executable);
+ PLUGIN_DEBUG("Executing java at %s\n", get_plugin_executable().c_str());
np_error = plugin_test_appletviewer ();
if (np_error != NPERR_NO_ERROR)
{
- fprintf(stderr, "Unable to find java executable %s\n", appletviewer_executable);
+ fprintf(stderr, "Unable to find java executable %s\n", get_plugin_executable().c_str());
return np_error;
}
@@ -2191,7 +2204,7 @@ NP_Initialize (NPNetscapeFuncs* browserTable, NPPluginFuncs* pluginTable)
plugin_instance_mutex = g_mutex_new ();
- PLUGIN_DEBUG ("NP_Initialize: using %s\n", appletviewer_executable);
+ PLUGIN_DEBUG ("NP_Initialize: using %s\n", get_plugin_executable().c_str());
plugin_req_proc = new PluginRequestProcessor();
java_req_proc = new JavaMessageSender();