#include <io.h>
#include <time.h>
#include <windows.h>
+#define dir_separator '\\'
+#else
+#define dir_separator '/'
#endif
using namespace std;
char *Tmp_dir = getenv("SALOME_TMP_DIR");
if(Tmp_dir != NULL) {
aTmpDir = string(Tmp_dir);
-#ifdef WIN32
+ if(aTmpDir[aTmpDir.size()-1] != dir_separator) aTmpDir+=dir_separator;
+/*#ifdef WIN32
if(aTmpDir[aTmpDir.size()-1] != '\\') aTmpDir+='\\';
#else
if(aTmpDir[aTmpDir.size()-1] != '/') aTmpDir+='/';
-#endif
+#endif*/
}
else {
#ifdef WIN32
aTmpDir += aSubDir; //Get RND sub directory
+ if(aTmpDir[aTmpDir.size()-1] != dir_separator) aTmpDir+=dir_separator;
+/*
#ifdef WIN32
if(aTmpDir[aTmpDir.size()-1] != '\\') aTmpDir+='\\';
#else
if(aTmpDir[aTmpDir.size()-1] != '/') aTmpDir+='/';
#endif
+ */
string aDir = aTmpDir;
}
#ifdef WNT
+ //fuction CreateDirectory create only final directory, but not intermediate
+ CreateDirectory(aTmpDir.c_str(), NULL);
CreateDirectory(aDir.c_str(), NULL);
#else
mkdir(aDir.c_str(), 0x1ff);
#endif
- return aDir;
+ return aDir + dir_separator;
}
char* makeName(char* name)
using namespace std;
-char* SALOMEDSImpl_GenericAttribute::Impl_GetType(DF_Attribute* theAttr)
+string SALOMEDSImpl_GenericAttribute::Impl_GetType(DF_Attribute* theAttr)
{
SALOMEDSImpl_GenericAttribute* ga = dynamic_cast<SALOMEDSImpl_GenericAttribute*>(theAttr);
- return (char*)ga->Type().c_str();
+ if (ga)
+ return ga->Type();
+
+ return "";
}
-char* SALOMEDSImpl_GenericAttribute::Impl_GetClassType(DF_Attribute* theAttr)
+string SALOMEDSImpl_GenericAttribute::Impl_GetClassType(DF_Attribute* theAttr)
{
SALOMEDSImpl_GenericAttribute* ga = dynamic_cast<SALOMEDSImpl_GenericAttribute*>(theAttr);
- return (char*)ga->GetClassType().c_str();
+ if (ga)
+ return ga->GetClassType();
+
+ return "";
}
void SALOMEDSImpl_GenericAttribute::Impl_CheckLocked(DF_Attribute* theAttr)
HDFdataset *hdf_dataset =0;
hdf_size size[1];
hdf_int32 name_len = 0;
- char *component_name = 0;
+ string component_name;
if(!aStudy) {
_errorCode = "Study is null";
hdf_sco_group2->CreateOnDisk();
SaveAttributes(SC, hdf_sco_group2);
// ComponentDataType treatment
- component_name = (char*)SC.ComponentDataType().c_str();
- name_len = (hdf_int32)strlen(component_name);
+ component_name = SC.ComponentDataType();
+ name_len = (hdf_int32)component_name.length();
size[0] = name_len +1 ;
hdf_dataset = new HDFdataset("COMPONENTDATATYPE",hdf_sco_group2,HDF_STRING,size,1);
hdf_dataset->CreateOnDisk();
- hdf_dataset->WriteOnDisk(component_name);
+ hdf_dataset->WriteOnDisk((char*)component_name.c_str());
hdf_dataset->CloseOnDisk();
hdf_dataset=0; //will be deleted by hdf_sco_group destructor
Impl_SaveObject(SC, hdf_sco_group2);
//-----------------------------------------------------------------------
//5 - Write the Study Properties
//-----------------------------------------------------------------------
- name_len = (hdf_int32) aStudy->Name().size();
+ string study_name = aStudy->Name();
+ name_len = (hdf_int32) study_name.size();
size[0] = name_len +1 ;
hdf_dataset = new HDFdataset("STUDY_NAME",hdf_group_study_structure,HDF_STRING,size,1);
hdf_dataset->CreateOnDisk();
- char* studid = (char*)aStudy->Name().c_str();
- hdf_dataset->WriteOnDisk(studid);
+ hdf_dataset->WriteOnDisk((char*)study_name.c_str());
hdf_dataset->CloseOnDisk();
hdf_dataset=0; // will be deleted by hdf_group_study_structure destructor
SALOMEDSImpl_SObject SO = SALOMEDSImpl_Study::SObject(itchild.Value());
- char* scoid = (char*) SO.GetID().c_str();
- hdf_group_sobject = new HDFgroup(scoid, hdf_group_datatype);
+ string scoid = SO.GetID();
+ hdf_group_sobject = new HDFgroup(scoid.c_str(), hdf_group_datatype);
hdf_group_sobject->CreateOnDisk();
SaveAttributes(SO, hdf_group_sobject);
Impl_SaveObject(SO, hdf_group_sobject);