Move check_file_exists() to file_utils.{h,cc}
This commit is contained in:
@ -54,4 +54,15 @@ persistent_data::open_bm(std::string const &dev_path, block_io<>::mode m)
|
||||
return block_manager<>::ptr(new block_manager<>(dev_path, nr_blocks, 1, m));
|
||||
}
|
||||
|
||||
void
|
||||
persistent_data::check_file_exists(string const &file) {
|
||||
struct stat info;
|
||||
int r = ::stat(file.c_str(), &info);
|
||||
if (r)
|
||||
throw runtime_error("Couldn't stat file");
|
||||
|
||||
if (!S_ISREG(info.st_mode))
|
||||
throw runtime_error("Not a regular file");
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user