-/* $Id$
-
-This file is part of the MSP Märklin suite
-Copyright © 2010 Mikkosoft Productions, Mikko Rasa
-Distributed under the GPL
-*/
-
#include <msp/core/getopt.h>
+#include <msp/fs/utils.h>
#include <msp/strings/lexicalcast.h>
#include <msp/strings/regex.h>
#include "options.h"
getopt.add_option('d', "driver", driver, GetOpt::REQUIRED_ARG);
getopt.add_option('s', "simulate", simulate, GetOpt::NO_ARG);
getopt.add_option('n', "network", network, GetOpt::NO_ARG);
+ getopt.add_option( "state", state_fn, GetOpt::REQUIRED_ARG);
getopt(argc, argv);
if(!res.empty())
screen_h = lexical_cast<unsigned>(m[2].str);
}
else
- throw UsageError("Invalid resolution");
+ throw usage_error("Invalid resolution");
}
const vector<string> &args = getopt.get_args();
if(args.empty())
- throw UsageError("No layout given");
+ throw usage_error("No layout given");
layout_fn = args[0];
+
+ if(state_fn.empty())
+ state_fn = FS::basepart(layout_fn)+".state";
}