]> git.tdb.fi Git - r2c2.git/blobdiff - source/engineer/options.cpp
Use per-layout state files
[r2c2.git] / source / engineer / options.cpp
index 9861c10e7e6230f282f8f1f4aaa6159c0e3d76c5..fc7516c16cc2405d91c7e92cf0944d9be07400f3 100644 (file)
@@ -6,6 +6,7 @@ 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"
@@ -30,6 +31,7 @@ Options::Options(int argc, char **argv):
        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())
@@ -48,4 +50,7 @@ Options::Options(int argc, char **argv):
                throw UsageError("No layout given");
 
        layout_fn = args[0];
+
+       if(state_fn.empty())
+               state_fn = FS::basepart(layout_fn)+".state";
 }