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