1 // SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
3 // Copyright (C) 2003 CEA/DEN, EDF R&D
7 // File : SALOMEDS_Tool.hxx
8 // Author : Sergey RUIN
11 #ifndef __SALOMEDS_Tool_H__
12 #define __SALOMEDS_Tool_H__
17 #include <SALOMEDS.hh>
23 // Returns the unique temporary directory, that is defined in SALOME_TMP_DIR if this variable is set
24 // otherwise return /tmp/something/ for Unix or c:\something\ for WNT
25 static char* GetTmpDir();
28 // Removes files which are in <theDirectory>, the files for deletion are listed in <theFiles>
29 // if <IsDirDeleted> is true <theDirectory> is also deleted if it is empty
30 static void RemoveTemporaryFiles(const char* theDirectory,
31 const SALOMEDS::ListOfFileNames& theFiles,
32 const bool IsDirDeleted);
34 // Converts files listed in <theFiles> which are in <theFromDirectory> into a byte sequence TMPFile
35 static SALOMEDS::TMPFile* PutFilesToStream(const char* theFromDirectory,
36 const SALOMEDS::ListOfFileNames& theFiles,
37 const int theNamesOnly = 0);
39 // Converts a byte sequence <theStream> to files and places them in <theToDirectory>
40 static SALOMEDS::ListOfFileNames* PutStreamToFiles(const SALOMEDS::TMPFile& theStream,
41 const char* theToDirectory,
42 const int theNamesOnly = 0);
44 // Returns the name by the path
45 // for an example: if thePath = "/tmp/aaa/doc1.hdf" the function returns "doc1"
46 static char* GetNameFromPath(const char* thePath);
48 // Returns the directory by the path
49 // for an example: if thePath = "/tmp/aaa/doc1.hdf" the function returns "/tmp/aaa"
50 static char* GetDirFromPath(const char* thePath);