diff --git a/pom.xml b/pom.xml index daca5af5ece80ab012f3bc338ea5f4b4018c0f31..e06b3143bd1aa5391c650a8b4312c68ac17d2837 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ </parent> <groupId>fr.soleil.lib</groupId> <artifactId>NexusCPP-${aol}-${library}-${mode}</artifactId> - <version>3.1.7</version> + <version>3.1.6</version> <packaging>nar</packaging> <name>NexusCPP</name> <description>NexusCPP library</description> diff --git a/src/impl/linux_nxfile.cpp b/src/impl/linux_nxfile.cpp index a6fafa1951cde50ad7e0d9e94b9494d7ca584093..483509e188e1316104db0ed35607ce16fe8b3536 100755 --- a/src/impl/linux_nxfile.cpp +++ b/src/impl/linux_nxfile.cpp @@ -779,11 +779,10 @@ public: m_lock_ptr.reset( new yat::LockFile( yat::FileName(path), yat::LockFile::READ) ); else if( NexusFile::WRITE ) m_lock_ptr.reset( new yat::LockFile( yat::FileName(path), yat::LockFile::WRITE) ); - else - throw NexusException("unknown open mode", "NexusFileImpl::NexusFileImpl"); } - Open(path, mode); + if( yat::FileName(path).file_exist() && mode != NexusFile::NONE ) + Open(path, mode); } ~NexusFileImpl() @@ -805,13 +804,12 @@ public: /// file related methods ... /// //////////////////////////////// - void Create(const std::string& path, ENexusCreateMode mode) + void Create(const std::string& path) { NXFILE_LOCK; NXFILEIMPL_COUT("Create"); - if (mode != NX_HDF5) - throw NexusException("unsupported creation mode", "NexusFileImpl::Create"); PrivOpenFile(path, H5F_ACC_TRUNC); + PrivCloseFile(); } bool Open(const std::string& path, NexusFile::OpenMode mode) @@ -1549,8 +1547,19 @@ private: /// create data set hsize_t dataDims[MAX_DATASET_NDIMS]; std::copy(dim, dim + rank, dataDims); - H5::DataSpace dataSpace(rank, dataDims); - H5::DataSet dataset = group->createDataSet(name, nexusData2h5Data(dataType), dataSpace, props); + H5::DataSpace dataSpace; + H5::DataType memDataType; + if( NX_CHAR == dataType && 1 == rank ) + { + // Characters string + memDataType = H5::StrType(0, dim[0] == 0 ? 1 : dim[0]); + } + else + { + dataSpace = H5::DataSpace(rank, dataDims); + memDataType = nexusData2h5Data(dataType); + } + H5::DataSet dataset = group->createDataSet(name, memDataType, dataSpace, props); /// push it if (open) PushTop(new H5::DataSet(dataset)); @@ -1751,9 +1760,9 @@ void NexusFile::Flush() //--------------------------------------------------------------------------- // NexusFile::Create //--------------------------------------------------------------------------- -void NexusFile::Create(const char *pcszFullPath, ENexusCreateMode eMode) +void NexusFile::Create(const char *pcszFullPath, ENexusCreateMode) { - m_pImpl->Create(pcszFullPath, eMode); + m_pImpl->Create(pcszFullPath); } //---------------------------------------------------------------------------