#include <cstring> // strchr
#include <iostream>
#include <stdexcept>
+#include <unistd.h>
#include <msg/msg.h>
#include <xbt/log.h>
return res;
}
+static void check_file_access(const std::string& name)
+{
+ if (access(name.c_str(), R_OK) != 0) {
+ std::cerr << "ERROR: cannot access to file \""
+ << name << "\" for reading: " << strerror(errno) << "\n";
+ exit(EXIT_FAILURE_ARGS);
+ }
+}
+
static void signal_handler(int /*sig*/)
{
if (!opt::exit_request) {
// Create the platform and the application.
XBT_DEBUG("Loading platform file...");
+ check_file_access(opt::platform_file);
MSG_create_environment(opt::platform_file.c_str());
XBT_DEBUG("Creating hostdata...");
hostdata::create();
}
MY_launch_application(); // it is already opt::* aware...
} else {
+ check_file_access(opt::deployment_file);
MSG_launch_application(opt::deployment_file.c_str());
}