From 701c083739a2f5e90552c6ac37bf048170dcec2c Mon Sep 17 00:00:00 2001 From: leonarski_f Date: Tue, 21 May 2024 10:22:37 +0200 Subject: [PATCH] MAX IV test day 1 modifications --- CMakeLists.txt | 23 +++++++++++++---------- VERSION | 2 +- writer/HDF5DataFile.cpp | 6 +++++- writer/HDF5NXmx.cpp | 3 ++- 4 files changed, 21 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8c913882..293c369d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -123,18 +123,21 @@ ELSE() ADD_SUBDIRECTORY(preview) ENDIF() -ADD_CUSTOM_COMMAND(OUTPUT frontend_ui/build/index.html - COMMAND npm install - COMMAND npm run build - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/frontend_ui) -ADD_CUSTOM_TARGET(frontend DEPENDS frontend_ui/build/index.html) +IF (NOT JFJOCH_WRITER_ONLY) + ADD_CUSTOM_COMMAND(OUTPUT frontend_ui/build/index.html + COMMAND npm install + COMMAND npm run build + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/frontend_ui) + ADD_CUSTOM_TARGET(frontend DEPENDS frontend_ui/build/index.html) -INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/fpga/pcie_driver/ - DESTINATION /usr/src/jfjoch-1.0.0 - COMPONENT driver-dkms - FILES_MATCHING PATTERN "*.c" PATTERN "*.h" PATTERN "Makefile" PATTERN "dkms.conf") + INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/fpga/pcie_driver/ + DESTINATION /usr/src/jfjoch-1.0.0 + COMPONENT driver-dkms + FILES_MATCHING PATTERN "*.c" PATTERN "*.h" PATTERN "Makefile" PATTERN "dkms.conf") -INSTALL(DIRECTORY frontend_ui/build/ DESTINATION share/jfjoch/frontend COMPONENT jfjoch ) + FILE(MAKE_DIRECTORY ${CMAKE_SOURCE_DIR}/frontend_ui/build/) + INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/frontend_ui/build/ DESTINATION share/jfjoch/frontend COMPONENT jfjoch ) +ENDIF() IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) SET(CMAKE_INSTALL_PREFIX /opt/jfjoch CACHE PATH "Default directory" FORCE) diff --git a/VERSION b/VERSION index 8d3e6e31..1fa52941 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.0.0-rc.5 +1.0.0_rc.5 diff --git a/writer/HDF5DataFile.cpp b/writer/HDF5DataFile.cpp index 05ea9ad2..4b59aac1 100644 --- a/writer/HDF5DataFile.cpp +++ b/writer/HDF5DataFile.cpp @@ -1,6 +1,8 @@ // Copyright (2019-2023) Paul Scherrer Institute #include +#include + #include "HDF5DataFile.h" #include "../compression/JFJochCompressor.h" @@ -50,7 +52,9 @@ std::optional HDF5DataFile::Close() { data_set.reset(); } data_file.reset(); - std::rename(tmp_filename.c_str(), filename.c_str()); + + if (!std::filesystem::exists(filename.c_str())) + std::rename(tmp_filename.c_str(), filename.c_str()); closed = true; diff --git a/writer/HDF5NXmx.cpp b/writer/HDF5NXmx.cpp index b3ba7f8a..df95a60a 100644 --- a/writer/HDF5NXmx.cpp +++ b/writer/HDF5NXmx.cpp @@ -36,7 +36,8 @@ NXmx::NXmx(const StartMessage &start) } NXmx::~NXmx() { - std::rename(tmp_filename.c_str(), filename.c_str()); + if (!std::filesystem::exists(filename.c_str())) + std::rename(tmp_filename.c_str(), filename.c_str()); } std::string HDF5Metadata::DataFileName(const std::string &prefix, int64_t file_number) {