aboutsummaryrefslogtreecommitdiffstats
path: root/plugin/icedteanp/IcedTeaPluginUtils.cc
diff options
context:
space:
mode:
authorJiri Vanek <[email protected]>2013-03-28 15:51:38 +0100
committerJiri Vanek <[email protected]>2013-03-28 15:51:38 +0100
commit8d2d31514295a2d0eff5971887246f6d4211fc6d (patch)
treed66ce4fb57c823a2aa8894bb6894b33bdbe162f6 /plugin/icedteanp/IcedTeaPluginUtils.cc
parent58b4d6e3dc3a95cfbc6f369287aca04763522e48 (diff)
Added code to parse properties and to find correct configuration files from c++ part of plugin.
Diffstat (limited to 'plugin/icedteanp/IcedTeaPluginUtils.cc')
-rw-r--r--plugin/icedteanp/IcedTeaPluginUtils.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/plugin/icedteanp/IcedTeaPluginUtils.cc b/plugin/icedteanp/IcedTeaPluginUtils.cc
index 6e41c19..d365b05 100644
--- a/plugin/icedteanp/IcedTeaPluginUtils.cc
+++ b/plugin/icedteanp/IcedTeaPluginUtils.cc
@@ -39,6 +39,7 @@ exception statement from your version. */
#include "IcedTeaNPPlugin.h"
#include "IcedTeaScriptablePluginObject.h"
#include "IcedTeaPluginUtils.h"
+#include <fstream>
/**
* Misc. utility functions used by the plugin
@@ -1068,6 +1069,21 @@ processAsyncCallQueue(void* param /* ignored */)
} while(1);
}
+void IcedTeaPluginUtilities::trim(std::string& str) {
+ size_t start = str.find_first_not_of(" \t\n"), end = str.find_last_not_of(" \t\n");
+ if (start == std::string::npos) {
+ return;
+ }
+ str = str.substr(start, end - start + 1);
+}
+
+bool IcedTeaPluginUtilities::file_exists(std::string filename)
+{
+ std::ifstream infile(filename.c_str());
+ return infile.good();
+}
+
+
/******************************************
* Begin JavaMessageSender implementation *
******************************************
@@ -1203,3 +1219,4 @@ MessageBus::post(const char* message)
PLUGIN_DEBUG("%p unlocked...\n", &msg_queue_mutex);
}
+