use find_last
parent
7ea22b694b
commit
cf8af6baf9
12
main.cc
12
main.cc
|
@ -218,11 +218,13 @@ static void ob_rule_cmd(cscript::CsState &, const char *tgt, const char *dep,
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
ObState os;
|
ObState os;
|
||||||
const char *lslash = strrchr(argv[0], '/');
|
ostd::ConstCharRange pn = argv[0];
|
||||||
if (lslash)
|
ostd::ConstCharRange lslash = ostd::find_last(pn, '/');
|
||||||
os.progname = lslash + 1;
|
if (!lslash.empty()) {
|
||||||
else
|
lslash.pop_front();
|
||||||
os.progname = argv[0];
|
os.progname = lslash;
|
||||||
|
} else
|
||||||
|
os.progname = pn;
|
||||||
|
|
||||||
cscript::init_lib_base(os.cs);
|
cscript::init_lib_base(os.cs);
|
||||||
cscript::init_lib_io(os.cs);
|
cscript::init_lib_io(os.cs);
|
||||||
|
|
Loading…
Reference in New Issue