Salome HOME
update resources
[tools/medcoupling.git] / src / ParaMEDMEMTest / ParaMEDMEMTest.cxx
index cb822f7ae1aa2d2bbf3b6838df5828c6ff53274f..4a18a8c08525c23c0615c61ab79e3be1ec4ad2cb 100644 (file)
@@ -1,9 +1,9 @@
-// Copyright (C) 2007-2013  CEA/DEN, EDF R&D
+// Copyright (C) 2007-2015  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 <unistd.h>
 #endif
 
-//================================================================================
-/*!
- * \brief Get path to the resources file.
- *
- * When running 'make test' source file is taken from MED_SRC/resources folder.
- * Otherwise, file is searched in ${MED_ROOT_DIR}/share/salome/resources/med folder.
- * 
- * \param filename name of the resource file (should not include a path)
- * \return full path to the resource file
- */
-//================================================================================
-
 std::string ParaMEDMEMTest::getResourceFile( const std::string& filename )
 {
   std::string resourceFile = "";
 
-  if ( getenv("top_srcdir") ) {
-    // we are in 'make check' step
-    resourceFile = getenv("top_srcdir");
-    resourceFile += "/resources/";
+  if ( getenv("MEDTOOL_ROOT_DIR") ) {
+    // use MEDTOOL_ROOT_DIR env.var
+    resourceFile = getenv("MEDTOOL_ROOT_DIR");
+    resourceFile += "/share/resources/med/";
   }
-  else if ( getenv("MED_ROOT_DIR") ) {
-    // use MED_ROOT_DIR env.var
-    resourceFile = getenv("MED_ROOT_DIR");
-    resourceFile += "/share/salome/resources/med/";
+  else {
+    resourceFile = get_current_dir_name();
+    resourceFile += "/../../resources/";
   }
+
   resourceFile += filename;
   return resourceFile;
 }
@@ -92,7 +80,7 @@ std::string ParaMEDMEMTest::getTmpDirectory()
 
 //================================================================================
 /*!
- * \brief Creates a copy of source file (if source file is specified) 
+ * \brief Creates a copy of source file (if source file is specified)
  * in the temporary directory and returns a path to the tmp file
  *
  * \param tmpfile name of the temporary file (without path)