aboutsummaryrefslogtreecommitdiffstats
path: root/plugin
diff options
context:
space:
mode:
Diffstat (limited to 'plugin')
-rw-r--r--plugin/icedteanp/IcedTeaNPPlugin.cc18
-rw-r--r--plugin/icedteanp/IcedTeaPluginUtils.cc30
-rw-r--r--plugin/icedteanp/IcedTeaPluginUtils.h2
3 files changed, 33 insertions, 17 deletions
diff --git a/plugin/icedteanp/IcedTeaNPPlugin.cc b/plugin/icedteanp/IcedTeaNPPlugin.cc
index 30ab716..9a0d0c4 100644
--- a/plugin/icedteanp/IcedTeaNPPlugin.cc
+++ b/plugin/icedteanp/IcedTeaNPPlugin.cc
@@ -1787,24 +1787,8 @@ initialize_plugin_table(NPPluginFuncs* pluginTable)
NPError
initialize_data_directory()
{
- const char* tmpdir_env = getenv("TMPDIR");
- if (tmpdir_env != NULL && g_file_test (tmpdir_env,
- (GFileTest) (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)))
- {
- data_directory = tmpdir_env;
- }
- else if (g_file_test (P_tmpdir,
- (GFileTest) (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)))
- {
- data_directory = P_tmpdir;
- }
- else
- {
- // If TMPDIR and P_tmpdir do not exist, try /tmp directly
- data_directory = "/tmp";
- }
- data_directory += "/icedteaplugin-";
+ data_directory = IcedTeaPluginUtilities::getRuntimePath() + "/icedteaplugin-";
if (getenv("USER") != NULL)
data_directory += getenv("USER");
diff --git a/plugin/icedteanp/IcedTeaPluginUtils.cc b/plugin/icedteanp/IcedTeaPluginUtils.cc
index dd2978f..0986aa8 100644
--- a/plugin/icedteanp/IcedTeaPluginUtils.cc
+++ b/plugin/icedteanp/IcedTeaPluginUtils.cc
@@ -1169,6 +1169,36 @@ void IcedTeaPluginUtilities::printDebugStatus(){
}
+std::string IcedTeaPluginUtilities::getTmpPath(){
+ const char* tmpdir_env = getenv("TMPDIR");
+ if (tmpdir_env != NULL && g_file_test (tmpdir_env,
+ (GFileTest) (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)))
+ {
+ return std::string(tmpdir_env);
+ }
+ else if (g_file_test (P_tmpdir,
+ (GFileTest) (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)))
+ {
+ return std::string(P_tmpdir);
+ }
+ else
+ {
+ // If TMPDIR and P_tmpdir do not exist, try /tmp directly
+ return "/tmp";
+ }
+}
+
+std::string IcedTeaPluginUtilities::getRuntimePath(){
+ const char* rntdir_env = getenv("XDG_RUNTIME_DIR");
+ if (rntdir_env != NULL && g_file_test (rntdir_env,
+ (GFileTest) (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)))
+ {
+ return std::string(rntdir_env);
+ }
+ return IcedTeaPluginUtilities::getTmpPath();
+}
+
+
/******************************************
* Begin JavaMessageSender implementation *
******************************************
diff --git a/plugin/icedteanp/IcedTeaPluginUtils.h b/plugin/icedteanp/IcedTeaPluginUtils.h
index c62faba..f0f52d7 100644
--- a/plugin/icedteanp/IcedTeaPluginUtils.h
+++ b/plugin/icedteanp/IcedTeaPluginUtils.h
@@ -387,6 +387,8 @@ class IcedTeaPluginUtilities
static std::string generateLogFileName();
static void initFileLog();
static void printDebugStatus();
+ static std::string getTmpPath();
+ static std::string getRuntimePath();
};
/*