summaryrefslogtreecommitdiffstats
path: root/vmchooser/main.cxx
diff options
context:
space:
mode:
authorBastian Wissler2009-08-26 16:46:16 +0200
committerBastian Wissler2009-08-26 16:46:16 +0200
commit67064b9d58b1b514f15e06b62fcbe74945e31243 (patch)
tree62ef9f3e20229e795426e748ac026171dd806264 /vmchooser/main.cxx
parentvmchooser bug: (diff)
downloadvmchooser-67064b9d58b1b514f15e06b62fcbe74945e31243.tar.gz
vmchooser-67064b9d58b1b514f15e06b62fcbe74945e31243.tar.xz
vmchooser-67064b9d58b1b514f15e06b62fcbe74945e31243.zip
Version 0.0.12 of vmchooser ;-)
=============================== * now omits <active> flag when starting xml explicitly * reads <active param="false" /> and just does not display them * fixed ugly bug, when the above mentioned flag was false ;-) git-svn-id: http://svn.openslx.org/svn/openslx/openslx-src-tools/vmchooser/trunk@3135 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'vmchooser/main.cxx')
-rw-r--r--vmchooser/main.cxx27
1 files changed, 22 insertions, 5 deletions
diff --git a/vmchooser/main.cxx b/vmchooser/main.cxx
index 579e938..a029a3a 100644
--- a/vmchooser/main.cxx
+++ b/vmchooser/main.cxx
@@ -12,6 +12,10 @@
#include <libxml/tree.h>
#include <libxml/xpath.h>
+#include <boost/filesystem.hpp>
+
+namespace bfs=boost::filesystem;
+
using namespace std;
using namespace fltk;
@@ -30,6 +34,7 @@ SWindow* mainwin;
*
*/
int main(int argc, char** argv) {
+ string version = "0.0.12";
AnyOption* opt = new AnyOption();
char* xmlpath = NULL;
char* lsesspath = NULL;
@@ -114,7 +119,7 @@ int main(int argc, char** argv) {
/* VERSION */
if(opt->getFlag('v') || opt->getFlag("version")) {
// just print out version information - helps testing
- cout << "virtual machine chooser 0.0.11"<< endl;
+ cout << "virtual machine chooser " << version << endl;
delete opt;
return 0;
@@ -159,15 +164,26 @@ int main(int argc, char** argv) {
// additional xml argument -> start image directly
if(opt->getArgc() > 0) {
+ string single_arg = opt->getArgv(0);
+ if(bfs::is_directory(single_arg)) {
+ fprintf(stderr, "Only argument is a folder, should be a valid xml file!\n");
+ return 1;
+ }
// read xml image
- xmlDoc* doc = xmlReadFile(opt->getArgv(0), NULL, XML_PARSE_RECOVER);
+ xmlDoc* doc = xmlReadFile(single_arg.c_str(), NULL, XML_PARSE_RECOVER);
if (doc == NULL) {
- fprintf(stderr, "Error: could not parse file %s\n", opt->getArgv(0));
+ fprintf(stderr, "Error: could not parse file %s\n", single_arg.c_str());
return 1;
}
DataEntry* result = get_entry(doc);
- runImage(*result, opt->getArgv(0));
+ if(result) {
+ runImage(*result, single_arg );
+ }
+ else {
+ fprintf(stderr, "Error: can not start image from xml\n\tcheck your <active> setting!\n");
+ return 1;
+ }
}
delete opt;
@@ -201,7 +217,8 @@ int main(int argc, char** argv) {
}
win.show(); // argc,argv
win.border(false);
- free(xmlpath);
+
+// free(xmlpath);
bool retval = run();