diff options
author | Sebastian Schmelzer | 2009-11-04 16:06:12 +0100 |
---|---|---|
committer | Sebastian Schmelzer | 2009-11-04 16:06:12 +0100 |
commit | abc8143ec11ca799d4d2e9ded75baf84fdd29f41 (patch) | |
tree | 7e73cd9aee1a2f4f6a31c2f6ef77d077c46c82dd | |
parent | Version 0.0.12 of vmchooser ;-) (diff) | |
download | vmchooser-abc8143ec11ca799d4d2e9ded75baf84fdd29f41.tar.gz vmchooser-abc8143ec11ca799d4d2e9ded75baf84fdd29f41.tar.xz vmchooser-abc8143ec11ca799d4d2e9ded75baf84fdd29f41.zip |
modify default paths
git-svn-id: http://svn.openslx.org/svn/openslx/openslx-src-tools/vmchooser/trunk@3195 95ad53e4-c205-0410-b2fa-d234c58c8868
-rw-r--r-- | vmchooser/addInfo.cxx | 14 | ||||
-rw-r--r-- | vmchooser/inc/paths.h | 9 | ||||
-rw-r--r-- | vmchooser/main.cxx | 10 | ||||
-rw-r--r-- | vmchooser/readXmlDir.cxx | 3 | ||||
-rw-r--r-- | vmchooser/runImage.cxx | 10 |
5 files changed, 37 insertions, 9 deletions
diff --git a/vmchooser/addInfo.cxx b/vmchooser/addInfo.cxx index aa1f16f..c1adf4a 100644 --- a/vmchooser/addInfo.cxx +++ b/vmchooser/addInfo.cxx @@ -1,4 +1,5 @@ #include "inc/functions.h" +#include "inc/paths.h" #include <iostream> #include <fstream> @@ -180,8 +181,19 @@ void readGroupXml(DataEntry* dat, string group) { xmlXPathObjectPtr xpp; int size = 0; + string grpXmlPath; + + grpXmlPath = string(VMCHOOSER_ETC_BASE_PATH) + .append("vmchooser-") + .append(group) + .append(".xml"); + + if (!bfs::is_regular(grpXmlPath)) { + return; + } + xmlDocPtr doc = xmlReadFile( - (string("/etc/opt/openslx/vmchooser-")+group+".xml").c_str(), + grpXmlPath.c_str(), NULL, XML_PARSE_RECOVER|XML_PARSE_NOERROR ); diff --git a/vmchooser/inc/paths.h b/vmchooser/inc/paths.h new file mode 100644 index 0000000..2b58c1a --- /dev/null +++ b/vmchooser/inc/paths.h @@ -0,0 +1,9 @@ +#ifndef PATHS_H +#define PATHS_H + +#define VMCHOOSER_PLUGIN_PATH "/opt/openslx/plugin-repo/vmchooser/" +#define VMCHOOSER_BIN_PATH "/var/opt/openslx/bin/" +#define VMCHOOSER_ETC_BASE_PATH "/etc/opt/openslx/plugins/vmchooser/" +#define VMCHOOSER_VMPATH "/var/lib/virt" + +#endif diff --git a/vmchooser/main.cxx b/vmchooser/main.cxx index a029a3a..cdcd6e1 100644 --- a/vmchooser/main.cxx +++ b/vmchooser/main.cxx @@ -7,6 +7,7 @@ #include "inc/DataEntry.h" #include "inc/functions.h" #include "inc/anyoption.h" +#include "inc/paths.h" #include <libxml/parser.h> #include <libxml/tree.h> @@ -34,7 +35,7 @@ SWindow* mainwin; * */ int main(int argc, char** argv) { - string version = "0.0.12"; + string version = "0.0.13"; AnyOption* opt = new AnyOption(); char* xmlpath = NULL; char* lsesspath = NULL; @@ -80,7 +81,10 @@ int main(int argc, char** argv) { * **/ - ifstream ifs ( "/etc/opt/openslx/vmchooser-stage3.conf" , ifstream::in ); + ifstream ifs ( + string(VMCHOOSER_ETC_BASE_PATH).append("vmchooser.conf").c_str(), + ifstream::in + ); if(ifs) { int n = 255; char buf[n]; @@ -113,7 +117,7 @@ int main(int argc, char** argv) { if (xmlpath == NULL) { // Default Path comes here - xmlpath = (char *) "/var/lib/virt/vmware/"; + xmlpath = (char *) VMCHOOSER_VMPATH; } /* VERSION */ diff --git a/vmchooser/readXmlDir.cxx b/vmchooser/readXmlDir.cxx index b90238b..a3952ca 100644 --- a/vmchooser/readXmlDir.cxx +++ b/vmchooser/readXmlDir.cxx @@ -23,6 +23,7 @@ #include "inc/constants.h" #include "inc/DataEntry.h" #include "inc/functions.h" +#include "inc/paths.h" namespace bfs=boost::filesystem; @@ -291,7 +292,7 @@ DataEntry** readXmlDir(char* path) } else { - ifstream conffile("/etc/opt/openslx/vmchooser-stage3.conf"); + ifstream conffile(string(VMCHOOSER_ETC_BASE_PATH).append("vmchooser.conf").c_str()); if(conffile) { int n = 255; char buf[n]; diff --git a/vmchooser/runImage.cxx b/vmchooser/runImage.cxx index 17d7190..ee84978 100644 --- a/vmchooser/runImage.cxx +++ b/vmchooser/runImage.cxx @@ -5,6 +5,7 @@ #include "inc/DataEntry.h" #include "inc/SWindow.h" #include "inc/functions.h" +#include "inc/paths.h" #include <sstream> @@ -46,7 +47,8 @@ void runImage(fltk::Widget*, void* p) strncpy(arg1, (char*) string("'\n\nStarte Image: ") .append(dat.short_description) .append("\n'").c_str(),MAX_LENGTH); - char* argv[] = { (char*) "/opt/openslx/plugin-repo/vmchooser/mesgdisp", + + char* argv[] = { (char*) string(VMCHOOSER_PLUGIN_PATH).append("mesgdisp").c_str(), arg1, NULL }; //printf("%s", arg1); @@ -90,11 +92,11 @@ void runImage(DataEntry& dat, string confxml) char* arg[] = { (char*) dat.command.c_str(), '\0' }; execvp((char*) dat.command.c_str(), arg); } - char* arg[] = { (char *) "/var/X11R6/bin/run-virt.sh", + char* arg[] = { (char *) string(VMCHOOSER_BIN_PATH).append("run-virt.sh").c_str(), (char*)confxml.c_str(), NULL }; - execvp("/var/X11R6/bin/run-virt.sh", arg); + execvp(string(VMCHOOSER_BIN_PATH).append("run-virt.sh").c_str(), arg); } @@ -131,7 +133,7 @@ char* getFolderName() { string writeConfXml(DataEntry& dat) { //char* pname = getFolderName(); - string pname = "/etc/opt/openslx/"; + string pname = VMCHOOSER_ETC_BASE_PATH; xmlNodePtr cur = 0; xmlNodePtr root = 0; |