Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Last Changes of CPP version of Msg
[simgrid.git] / src / cxx / Environment.cxx
index 489c814..806e868 100644 (file)
   \r
 #include <Environment.hpp>\r
 \r
+#include <NullPointerException.hpp>\r
+#include <FileNotFoundException.hpp>\r
+#include <InvalidArgumentException.hpp>\r
+#include <LogicException.hpp>\r
+#include <MsgException.hpp>\r
+\r
+#include <stdlib.h>\r
+\r
 #include <sys/types.h>\r
 #include <sys/stat.h>\r
 \r
+#include <msg/msg.h>\r
+\r
 #ifndef S_ISREG\r
        #define S_ISREG(__mode) (((__mode) & S_IFMT) == S_IFREG)\r
 #endif\r
@@ -32,14 +42,14 @@ namespace SimGrid
                        this->loaded = false;\r
                }\r
                                \r
-               Environment::Environment(const Environment& rEnvironment);\r
+               Environment::Environment(const Environment& rEnvironment)\r
                {\r
                        this->file = rEnvironment.getFile();\r
                        this->loaded = rEnvironment.isLoaded();\r
                }\r
                \r
                Environment::Environment(const char* file)\r
-               throw(NullPointerException, InvalidArgumentException);\r
+               throw(NullPointerException, InvalidArgumentException)\r
                {\r
                        // check parameters\r
                        \r
@@ -48,8 +58,8 @@ namespace SimGrid
                        \r
                        struct stat statBuf = {0};\r
                                \r
-                       if(stat(statBuff, &info) < 0 || !S_ISREG(statBuff.st_mode))\r
-                               throw InvalidParameterException("file (file not found)");\r
+                       if(stat(file, &statBuf) < 0 || !S_ISREG(statBuf.st_mode))\r
+                               throw InvalidArgumentException("file (file not found)");\r
                                \r
                        this->file = file;\r
                        this->loaded = false;\r
@@ -94,7 +104,7 @@ namespace SimGrid
                        \r
                        struct stat statBuf = {0};\r
                                \r
-                       if(stat(statBuff, &info) < 0 || !S_ISREG(statBuff.st_mode))\r
+                       if(stat(file, &statBuf) < 0 || !S_ISREG(statBuf.st_mode))\r
                                throw FileNotFoundException(file);\r
                                        \r
                        MSG_create_environment(file);\r
@@ -124,7 +134,7 @@ namespace SimGrid
                        \r
                        struct stat statBuf = {0};\r
                                \r
-                       if(stat(statBuff, &info) < 0 || !S_ISREG(statBuff.st_mode))\r
+                       if(stat(file, &statBuf) < 0 || !S_ISREG(statBuf.st_mode))\r
                                throw FileNotFoundException("file (file not found)");\r
                                \r
                        this->file = file;\r