...
This commit is contained in:
parent
34959c632d
commit
bb28f0aa03
@ -997,15 +997,20 @@ void RaptorEagleCCD::startAquisition()
|
||||
// check filesystem permissions
|
||||
std::error_code ec;
|
||||
std::filesystem::path pt(acq_pars->filename);
|
||||
pt = std::filesystem::canonical(pt.parent_path(), ec);
|
||||
if (ec) {
|
||||
logError("Invalid FITS-image filename path!");
|
||||
throw std::system_error(ec);
|
||||
pt = pt.parent_path();
|
||||
if (pt.empty()) {
|
||||
pt = ".";
|
||||
}
|
||||
|
||||
int res = access(pt.c_str(), W_OK | X_OK);
|
||||
if (!res) {
|
||||
logError("Invalid FITS-image filename! Insufficient filesystem permissions!");
|
||||
auto pt_cn = std::filesystem::canonical(pt, ec);
|
||||
if (ec) {
|
||||
logError("Invalid FITS-image filename path: {}", pt.c_str());
|
||||
throw std::system_error(RaptorEagleCCDError::ERROR_INVALID_PATH);
|
||||
}
|
||||
|
||||
int res = access(pt_cn.c_str(), W_OK | X_OK);
|
||||
if (res == -1) {
|
||||
logError("Invalid FITS-image path! Insufficient filesystem permissions!");
|
||||
throw std::system_error(RaptorEagleCCDError::ERROR_INSUFFICIENT_FILESYSTEM_PERMISSIONS);
|
||||
}
|
||||
|
||||
|
||||
@ -16,6 +16,7 @@ enum class RaptorEagleCCDError : int {
|
||||
ERROR_CANNOT_RESET_FPGA,
|
||||
ERROR_EXT_TRIGGER_MODE,
|
||||
ERROR_ACQUISITION_IN_PROGRESS,
|
||||
ERROR_INVALID_PATH,
|
||||
ERROR_INSUFFICIENT_FILESYSTEM_PERMISSIONS
|
||||
};
|
||||
|
||||
@ -63,6 +64,8 @@ struct RaptorEagleCCDErrorCategory : std::error_category {
|
||||
return "try to use software trigger while external trigger mode is enabled";
|
||||
case RaptorEagleCCDError::ERROR_ACQUISITION_IN_PROGRESS:
|
||||
return "acquisition is in progress";
|
||||
case RaptorEagleCCDError::ERROR_INVALID_PATH:
|
||||
return "invalid filesystem path";
|
||||
case RaptorEagleCCDError::ERROR_INSUFFICIENT_FILESYSTEM_PERMISSIONS:
|
||||
return "insufficient filesystem permissions";
|
||||
default:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user