55 G_EXCEPTION_CLASS( Error ,
tx(
"batch file error") )
64 std::string
line()
const ;
71 std::string
name()
const ;
82 const std::string & start_window_name = {} ,
bool do_backup = false ) ;
90 void init(
const Path & ) ;
92 static std::string quote(
const std::string & ) ;
93 static std::string percents(
const std::string & ) ;
94 static void dequote( std::string & ) ;
95 std::string readFrom( std::istream & ,
const std::string & ,
bool do_throw =
true ) ;
102 static ParseResult parse(
const std::string & ) ;
104 static bool ignorable(
const std::string &
line ) ;
105 static bool relevant(
const std::string &
line ) ;
106 static void backup(
const Path & ) ;
109 std::string m_raw_line ;
A class for reading and writing windows-style startup batch files containing a single command-line,...
const StringArray & args() const
Returns the startup command-line broken up into de-quoted pieces.
bool empty() const
Returns true if line() is empty.
std::size_t lineArgsPos() const
Returns the position in line() where the arguments start.
std::string name() const
Returns the "start" window name, if any.
BatchFile(const Path &)
Constructor that reads from a file.
std::string line() const
Returns the main command-line from within the batchfile, with normalised spaces, without any "start" ...
static void write(const Path &new_batch_file, const StringArray &args, const std::string &start_window_name={}, bool do_backup=false)
Writes a startup batch file, including a "start" prefix.
A Path object represents a file system path.
std::vector< std::string > StringArray
A std::vector of std::strings.
constexpr const char * tx(const char *p) noexcept
A briefer alternative to G::gettext_noop().