mirror of
https://github.com/chocolate-doom/launcher.git
synced 2024-11-21 20:21:04 +00:00
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:
parent
4fc6472d9b
commit
d7617011e0
3 changed files with 62 additions and 0 deletions
|
@ -45,6 +45,7 @@
|
|||
- (BOOL) setDropdownList;
|
||||
- (void) setDropdownSelection;
|
||||
- (void) saveConfig;
|
||||
- (void) setEnvironment;
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <AppKit/AppKit.h>
|
||||
#include "IWADController.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
|
||||
|
||||
|
|
|
@ -83,6 +83,7 @@
|
|||
{
|
||||
[self saveConfig];
|
||||
|
||||
[self->iwadController setEnvironment];
|
||||
ExecuteProgram("chocolate-setup", NULL, NULL);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue