mirror of
https://github.com/ksherlock/mpw-shell.git
synced 2025-01-23 09:31:20 +00:00
be more helpful if mpw / Startup file does not exist.
This commit is contained in:
parent
76980a6e06
commit
e2affa1bdd
@ -50,15 +50,23 @@ fs::path root() {
|
|||||||
if (!cp || !*cp) {
|
if (!cp || !*cp) {
|
||||||
auto pw = getpwuid(getuid());
|
auto pw = getpwuid(getuid());
|
||||||
if (!pw) {
|
if (!pw) {
|
||||||
fprintf(stderr,"Unable to determine home directory\n.");
|
fprintf(stderr,"### Unable to determine home directory\n.");
|
||||||
exit(EX_NOUSER);
|
exit(EX_NOUSER);
|
||||||
}
|
}
|
||||||
cp = pw->pw_dir;
|
cp = pw->pw_dir;
|
||||||
}
|
}
|
||||||
root = cp;
|
root = cp;
|
||||||
//if (root.back() != '/') root.push_back('/');
|
|
||||||
//root += "mpw/";
|
|
||||||
root /= "mpw/";
|
root /= "mpw/";
|
||||||
|
fs::error_code ec;
|
||||||
|
fs::file_status st = status(root, ec);
|
||||||
|
if (!fs::exists(st)) {
|
||||||
|
fprintf(stderr, "### Warning: %s does not exist.\n", root.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (!fs::is_directory(st)) {
|
||||||
|
fprintf(stderr, "### Warning: %s is not a directory.\n", root.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
@ -521,8 +529,13 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
if (!cflag) fprintf(stdout, "MPW Shell " VERSION "\n");
|
if (!cflag) fprintf(stdout, "MPW Shell " VERSION "\n");
|
||||||
if (!fflag) {
|
if (!fflag) {
|
||||||
|
fs::path startup = root() / "Startup";
|
||||||
e.startup(true);
|
e.startup(true);
|
||||||
read_file(p1, root() / "Startup");
|
try {
|
||||||
|
read_file(p1, startup);
|
||||||
|
} catch (const std::system_error &ex) {
|
||||||
|
fprintf(stderr, "### %s: %s\n", startup.c_str(), ex.what());
|
||||||
|
}
|
||||||
e.startup(false);
|
e.startup(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user