Salome HOME
Copyright update 2021
[modules/hexablock.git] / src / TEST_CPP / test_tools.cxx
old mode 100755 (executable)
new mode 100644 (file)
index bfb2782..dc7c790
@@ -1,12 +1,12 @@
 
 // C++ : Outils communs aux tests unitaires
 
-// Copyright (C) 2009-2013  CEA/DEN, EDF R&D
+// Copyright (C) 2009-2021  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 
 #include <string>
 #include <cstdlib>
+#ifndef WIN32
 #include <unistd.h>
+#endif
 
 #include <sys/types.h>   // pour getpid()
+#ifndef WIN32
 #include <unistd.h>      // pour getpid()
+#else
+#include <direct.h>
+#include <process.h>
+#endif
+
 
 static int nbr_vtk = 0;
 static cpchar case_name = "hexa";
@@ -50,7 +58,11 @@ void goto_workspace ()
 
    if (w_default)
       {
+#ifndef WIN32
       pid_t pid = getpid ();
+#else
+     int pid = _getpid ();
+#endif
       char     bufpid [8];
       sprintf (bufpid, "_p%d", pid);
       workspace += bufpid;
@@ -60,7 +72,12 @@ void goto_workspace ()
    call_system (rmdir + workspace);
    call_system (mkdir + workspace);
 
+#ifndef WIN32
    chdir (workspace.c_str());
+#else
+   _chdir (workspace.c_str());
+#endif
+
 }
 // ======================================================== free_workspace
 void free_workspace ()