When running setup tool, set DOOMWADPATH environment variable to include

paths to all IWADs set in the configuration window.

Subversion-branch: /launcher
Subversion-revision: 1768
This commit is contained in:
Simon Howard 2009-12-27 02:16:10 +00:00
parent 4fc6472d9b
commit d7617011e0
3 changed files with 62 additions and 0 deletions

View file

@ -45,6 +45,7 @@
- (BOOL) setDropdownList; - (BOOL) setDropdownList;
- (void) setDropdownSelection; - (void) setDropdownSelection;
- (void) saveConfig; - (void) saveConfig;
- (void) setEnvironment;
@end @end

View file

@ -20,6 +20,8 @@
// //
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
#include <stdlib.h>
#include <string.h>
#include <AppKit/AppKit.h> #include <AppKit/AppKit.h>
#include "IWADController.h" #include "IWADController.h"
#include "IWADLocation.h" #include "IWADLocation.h"
@ -265,5 +267,63 @@ static NSString *IWADFilenames[NUM_IWAD_TYPES + 1] =
} }
} }
// Set the DOOMWADPATH environment variable to contain the path to each
// of the configured IWAD files.
- (void) setEnvironment
{
IWADLocation *iwadList[NUM_IWAD_TYPES];
NSString *location;
unsigned int i;
unsigned int len;
BOOL first;
char *env;
[self getIWADList: iwadList];
// Calculate length of environment string.
len = 30;
for (i=0; i<NUM_IWAD_TYPES; ++i)
{
location = [iwadList[i] getLocation];
if (location != nil && [location length] > 0)
{
len += [location length] + 1;
}
}
// Build string.
env = malloc(len);
strcpy(env, "DOOMWADPATH=");
first = YES;
for (i=0; i<NUM_IWAD_TYPES; ++i)
{
location = [iwadList[i] getLocation];
if (location != nil && [location length] > 0)
{
if (!first)
{
strcat(env, ":");
}
strcat(env, [location UTF8String]);
first = NO;
}
}
// Load into environment:
putenv(env);
//free(env);
}
@end @end

View file

@ -83,6 +83,7 @@
{ {
[self saveConfig]; [self saveConfig];
[self->iwadController setEnvironment];
ExecuteProgram("chocolate-setup", NULL, NULL); ExecuteProgram("chocolate-setup", NULL, NULL);
} }