--- nono/host/hostwindrv.cpp 2026/04/29 17:05:26 1.1 +++ nono/host/hostwindrv.cpp 2026/04/29 17:05:30 1.1.1.2 @@ -41,10 +41,9 @@ HostWindrv::~HostWindrv() } // ルートパスの設定。 -void +bool HostWindrv::InitRootPath(const std::string& rootpath_) { - assert(rootpath_.empty() == false); rootpath = rootpath_; // ルートパスのほうは末尾の '/' なし。 @@ -55,6 +54,24 @@ HostWindrv::InitRootPath(const std::stri if (rootpath.empty()) { rootpath = "."; } + + struct stat st; + int r = stat(rootpath.c_str(), &st); + if (r < 0) { + putmsg(1, "stat '%s': %s", rootpath.c_str(), strerror(errno)); + return false; + } + if (!S_ISDIR(st.st_mode)) { + putmsg(1, "stat '%s': Not directory", rootpath.c_str()); + return false; + } + r = access(rootpath.c_str(), R_OK | X_OK); + if (r != 0) { + putmsg(1, "access '%s': %s", rootpath.c_str(), strerror(errno)); + return false; + } + + return true; } // 初期化コマンド。