Here is the code for test.pl:
use warnings;
use strict;
use Module::Load;
if(! $ENV{SPRING_WRITEDIR}) {
$ENV{SPRING_WRITEDIR}='E:\\test';
exec {$^X} ($^X,$0);
}
$ENV{PATH}="E:\\springrts;$ENV{PATH}";
load("PerlUnitSync");
PerlUnitSync::Init(0,0);
my $writeDir=PerlUnitSync::GetWritableDataDirectory();
print "writeDir=$writeDir\n";
Here is the output:
E:\test>perl test.pl
E:\test>writeDir=E:\test\
And now the output if I comment the exec line:
E:\test>perl test.pl
writeDir=D:\Documents\My Games\Spring\
As you can see the SPRING_WRITEDIR environment variable is not taken into account if I don't use exec.
|