$os_name = $^O;

if ($os_name =~ "linux") {
    $ENV{'IDENTITY_DIR'} = "/root/.ssh";
    $ENV{'munges'} = "";
    $ENV{'TASK_HOME'} = "/greenstone/diffcol"; # "/greenstone/envi/etc/tasks/diffcol";
}

if ($os_name =~ "MSWin32") {
    # We should always be able to run diffcol in 32 or 64 bit, as both should be supported
    # just like diffcol is supported for both GS3 and GS2.
    #my $home_dir = "D:\\greenstone\\gs-release-builder-64bit";
    my $home_dir = "D:\\greenstone\\gs-release-builder-".$bitness."bit";
    
    #diffcol Win environment
    $ENV{'IDENTITY_DIR'} = "$home_dir\\keys";
    $ENV{'munges'} = "";
    $ENV{'TASK_HOME'} = "$home_dir\\diffcol";
    #$ENV{'GSDLHOME'} = "$ENV{'TASK_HOME'}\\greenstone2" unless defined $ENV{'GSDLHOME'};
    
    # need the correct perl on the PATH in order to be able to run import.pl from within diffcol\task.pl via envi 
    # (else calling 'envi.pl diffcol run_test' used to fail on the first GS script, import)
    ##$ENV{'PERLPATH'}="C:\\Perl64\\bin";
    #$ENV{'PATH'}="C:\\Perl64\\bin;$ENV{'PATH'}";
    
    #$ENV{'ANT_HOME'}="C:\\Users\\GameJam\\apache-ant-1.9.5";
    #$ENV{'JAVA_HOME'}="C:\\Program Files\\Java\\jdk1.8.0_191";
    #$ENV{'PATH'}="$home_dir\\strawberry-perl32no64\\perl\\bin;$ENV{'ANT_HOME'}\\bin;$ENV{'JAVA_HOME'}\\bin;C:\\Program Files\\SlikSvn\\bin;$ENV{'PATH'}";
    
    # Need path to UNIXtools/linux utilities and must have GS3/gs2build/bin/windows' wget in there and wgetrc file
	# https://unxutils.sourceforge.net/
	# ( https://gnuwin32.sourceforge.net/packages/coreutils.htm )
	
	# diffcol has its own ability to upload as well as happening through nightlies-with-logs.bat/upload-to-www-internal-windows.pl with all the caveats.
	# For that, we need Putty\plink.exe on the PATH
	$ENV{'PATH'}="D:\\PuTTY;$home_dir\\UnxUpdates;$ENV{'PATH'}"; # To have access to 7z(.exe), could prepend C:\\Program Files\\7-Zip;
}

if ($os_name =~ "darwin") {
    $ENV{'IDENTITY_DIR'} = "/Users/greenstone/.ssh";    
    $ENV{'munges'} = "";
    $ENV{'TASK_HOME'} = "/Users/greenstone/gs-release-builder/diffcol";

    #$ENV{'ANT_HOME'} = "$ENV{'RELEASES_DIR'}/ant-1.9.4";

    ##$ENV{'JRE_HOME'} = "$ENV{RELEASES_DIR}/JDK8u301/Home/jre";
    ##$ENV{'PATH'} = "$ENV{'PATH'}:$ENV{'JRE_HOME'}/bin:$ENV{'ANT_HOME'}/bin";
    #$ENV{'PATH'} = "$ENV{'ANT_HOME'}/bin:$ENV{'PATH'}";

    # Let's add SVN to PATH, because cron jobs can't seem to find it (for nightly expeditee anyway)
    # On mac, it's been installed at /usr/local/bin/svn
    $ENV{'PATH'} = "/usr/local/bin:$ENV{'PATH'}";
}
