1 // File : SALOMEDS_Tool.hxx
2 // Created : Mon Oct 21 16:24:50 2002
3 // Author : Sergey RUIN
7 // Copyright : Open CASCADE
10 #ifndef __SALOMEDS_Tool_H__
11 #define __SALOMEDS_Tool_H__
16 #include <SALOMEDS.hh>
22 // Returns the unique temporary directory, that is defined in SALOME_TMP_DIR if this variable is set
23 // otherwise return /tmp/something/ for Unix or c:\something\ for WNT
24 static char* GetTmpDir();
27 // Removes files which are in <theDirectory>, the files for deletion are listed in <theFiles>
28 // if <IsDirDeleted> is true <theDirectory> is also deleted if it is empty
29 static void RemoveTemporaryFiles(const char* theDirectory,
30 const SALOMEDS::ListOfFileNames& theFiles,
31 const bool IsDirDeleted);
33 // Converts files listed in <theFiles> which are in <theFromDirectory> into a byte sequence TMPFile
34 static SALOMEDS::TMPFile* PutFilesToStream(const char* theFromDirectory,
35 const SALOMEDS::ListOfFileNames& theFiles,
36 const int theNamesOnly = 0);
38 // Converts a byte sequence <theStream> to files and places them in <theToDirectory>
39 static SALOMEDS::ListOfFileNames* PutStreamToFiles(const SALOMEDS::TMPFile& theStream,
40 const char* theToDirectory,
41 const int theNamesOnly = 0);
43 // Returns the name by the path
44 // for an example: if thePath = "/tmp/aaa/doc1.hdf" the function returns "doc1"
45 static char* GetNameFromPath(const char* thePath);
47 // Returns the directory by the path
48 // for an example: if thePath = "/tmp/aaa/doc1.hdf" the function returns "/tmp/aaa"
49 static char* GetDirFromPath(const char* thePath);