Fixed simplix and usr bad assuption that the robot xml file is near the dll/so file

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@535 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: ffd243bae2bb066d7c5720ecd9a10fde6593cb76
Former-commit-id: a795b24bab40664117ed65f549a1576f726ebcc0
This commit is contained in:
pouillot 2008-12-20 22:22:50 +00:00
parent be8bcb3633
commit 6c863b6e34
2 changed files with 10 additions and 11 deletions

View file

@ -136,10 +136,10 @@ static char DriverDescs[DRIVERLEN * MAX_NBBOTS]; // Buffer for driver's descript
// Number of drivers defined in robot's xml-file // Number of drivers defined in robot's xml-file
static int NBBOTS = 0; // Still unknown static int NBBOTS = 0; // Still unknown
// Robot's name // Robot's name
static char nameBuffer[BUFSIZE]; // Buffer for robot's name static char nameBuffer[BUFSIZE]; // Buffer for robot's name
static const char* robotName = nameBuffer; // Pointer to robot's name static const char* robotName = nameBuffer; // Pointer to robot's name
// Robot's xml-filename // Robot's xml-filename
static char pathBuffer[BUFSIZE]; // Buffer for robot's xml-filename static char pathBuffer[BUFSIZE]; // Buffer for robot's xml-filename
static const char* pathXml = pathBuffer; // Pointer to robot's xml-filename static const char* pathXml = pathBuffer; // Pointer to robot's xml-filename
// Robot's dir // Robot's dir
static char dirBuffer[BUFSIZE]; static char dirBuffer[BUFSIZE];
@ -225,13 +225,13 @@ void SetUpSimplix_36GP()
//==========================================================================* //==========================================================================*
// Set robots's name, path and xml file pathname // Set robots's name, path and xml file pathname
//--------------------------------------------------------------------------* //--------------------------------------------------------------------------*
static void setRobotNameAndDir(const char *name, const char *dir) static void setRobotName(const char *name)
{ {
char* c; char* c;
strcpy(nameBuffer, name); strcpy(nameBuffer, name);
strcpy(dirBuffer, dir); snprintf(dirBuffer, BUFSIZE, "drivers/%s", name);
snprintf(pathBuffer, BUFSIZE, "%s/%s.xml", dir, name); snprintf(pathBuffer, BUFSIZE, "%s/%s.xml", robotDir, name);
GfOut("Robot Name: >%s<\n",robotName); GfOut("Robot Name: >%s<\n",robotName);
} }
@ -246,9 +246,8 @@ extern "C" int moduleWelcome(const tModWelcomeIn* welcomeIn, tModWelcomeOut* wel
int i; int i;
// Save module name and loadDir, and determine module XML file pathname. // Save module name and loadDir, and determine module XML file pathname.
setRobotNameAndDir(welcomeIn->name, welcomeIn->loadPath); setRobotName(welcomeIn->name);
GfOut("\n\n\nRobot dir: %s\n",robotDir);
GfOut("Robot XML-Path: %s\n\n",pathXml); GfOut("Robot XML-Path: %s\n\n",pathXml);
// Filehandle for robot's xml-file // Filehandle for robot's xml-file

View file

@ -93,13 +93,13 @@ void SetUpUSR_GP3601()
// Add usr_GP3601 specific initialization here // Add usr_GP3601 specific initialization here
}; };
// Set robots's name, path and xml file pathname // Set robots's name and xml file pathname
static void setRobotNameAndDir(const char *name, const char *dir) static void setRobotName(const char *name)
{ {
char* c; char* c;
strcpy(nameBuffer, name); strcpy(nameBuffer, name);
snprintf(pathBuffer, BUFSIZE, "%s/%s.xml", dir, name); snprintf(pathBuffer, BUFSIZE, "drivers/%s/%s.xml", name, name);
GfOut("Robot Name: >%s<\n",robotName); GfOut("Robot Name: >%s<\n",robotName);
} }
@ -111,7 +111,7 @@ extern "C" int moduleWelcome(const tModWelcomeIn* welcomeIn, tModWelcomeOut* wel
int i; int i;
// Save module name and loadDir, and determine module XML file pathname. // Save module name and loadDir, and determine module XML file pathname.
setRobotNameAndDir(welcomeIn->name, welcomeIn->loadPath); setRobotName(welcomeIn->name);
GfOut("Robot XML-Path: %s\n\n",pathXml); GfOut("Robot XML-Path: %s\n\n",pathXml);