Changeset 15111 for trunk/FACT++


Ignore:
Timestamp:
03/18/13 16:43:51 (12 years ago)
Author:
tbretz
Message:
The name of the program has to be extracted from conf.GetName()
Location:
trunk/FACT++/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/StateMachineDimControl.cc

    r15087 r15111  
    11#include "StateMachineDimControl.h"
     2
     3#include <boost/filesystem.hpp>
    24
    35#include "Dim.h"
     
    546548    //     fVerbosity = 90;
    547549
    548     if (conf.GetName()=="dimserver")
     550    const boost::filesystem::path path(conf.GetName());
     551    const string fname = path.filename().string();
     552
     553    if (fname=="dimserver")
    549554        return -1;
    550555
  • trunk/FACT++/src/dimctrl.cc

    r15086 r15111  
    1111int RunShell(Configuration &conf)
    1212{
    13     StateMachineDimControl::fIsServer = conf.GetName()=="dimserver";
     13    const boost::filesystem::path path(conf.GetName());
     14    const string fname = path.filename().string();
     15
     16    StateMachineDimControl::fIsServer = fname=="dimserver";
    1417    return Main::execute<T, StateMachineDimControl>(conf);
    1518}
     
    1720void SetupConfiguration(Configuration &conf)
    1821{
    19     po::options_description control("Options ("+conf.GetName()+")");
     22    const boost::filesystem::path path(conf.GetName());
     23    const string fname = path.filename().string();
     24
     25    po::options_description control("Options ("+fname+")");
    2026    control.add_options()
    2127        ("force-console", po_switch(),     "Forces console mode in server-mode.")
    2228        ("debug",         po_bool(false),  "Print the labels for debugging purpose")
    2329        ("user,u",        var<string>(""), "A user name - just for logging purposes (default is ${USER})")
    24         ("JavaScript.*",  var<string>(""), "Additional arguments which are provided to JavaScripts started in a dimctrl server via the START command")
     30        ("JavaScript.*",  var<string>(),  "Additional arguments which are provided to JavaScripts started in a dimctrl server via the START command")
    2531        ;
    2632
    27     if (conf.GetName()!="dimserver")
     33    if (fname!="dimserver")
    2834    {
    2935        control.add_options()
     
    102108        throw runtime_error("--force-console must be used with --console/-c");
    103109
    104     if (conf.GetName()=="dimserver" && !conf.Get<bool>("force-console"))
     110    const boost::filesystem::path path(conf.GetName());
     111    const string fname = path.filename().string();
     112
     113    if (fname=="dimserver" && !conf.Get<bool>("force-console"))
    105114        conf.Remove("console");
    106115
Note: See TracChangeset for help on using the changeset viewer.