! use File::Copy;
! use Cwd;

COMMAND FILE:
  CFX Pre Version = 13.0
END

! getEgFile("CombustorEDM.cfx");

>load filename=CombustorEDM.cfx, mode=cfx, \
overwrite=yes
> update

>writeCaseFile filename=CombustorFlamelet.cfx
> update

>delete /LIBRARY/REACTION:Methane Air WD1 NO PDF
> update

>delete /LIBRARY/REACTION:Thermal NO PDF
> update

# Imported library information
# already have dependency /LIBRARY/MATERIAL:N2
# already have dependency /LIBRARY/MATERIAL:NO
LIBRARY:
  &replace MATERIAL: O
    Material Description = Atomic Oxygen O
    Option = Pure Substance
    Thermodynamic State = Gas
    Material Group = Gas Phase Combustion
    PROPERTIES: PROPERTIES
      Option = General Material
      SPECIFIC HEAT CAPACITY: SPECIFIC HEAT CAPACITY
        Option = NASA Format
        TEMPERATURE LIMITS: TEMPERATURE LIMITS
          Lower Temperature = 300 [K]
          Midpoint Temperature = 1000 [K]
          Upper Temperature = 5000 [K]
        END
        LOWER INTERVAL COEFFICIENTS: LOWER INTERVAL COEFFICIENTS
          NASA a1 = 0.02946429E+02 []
          NASA a2 = -0.01638166E-01 [K^-1]
          NASA a3 = 0.02421032E-04 [K^-2]
          NASA a4 = -0.01602843E-07 [K^-3]
          NASA a5 = 0.03890696E-11 [K^-4]
          NASA a6 = 0.02914764E+06 [K]
          NASA a7 = 0.02963995E+02 []
        END
        UPPER INTERVAL COEFFICIENTS: UPPER INTERVAL COEFFICIENTS
          NASA a1 = 0.02542060E+02 []
          NASA a2 = -0.02755062E-03 [K^-1]
          NASA a3 = -0.03102803E-07 [K^-2]
          NASA a4 = 0.04551067E-10 [K^-3]
          NASA a5 = -0.04368052E-14 [K^-4]
          NASA a6 = 0.02923080E+06 [K]
          NASA a7 = 0.04920308E+02 []
        END
      END
      REFERENCE STATE: REFERENCE STATE
        Option = NASA Format
        Reference Pressure = 1 [atm]
        Reference Temperature = 25 [C]
      END
      DYNAMIC VISCOSITY: DYNAMIC VISCOSITY
        Dynamic Viscosity = 17.7E-06 [kg m^-1 s^-1]
        Option = Value
      END
      REFRACTIVE INDEX: REFRACTIVE INDEX
        Option = Value
        Refractive Index = 1.0 [m m^-1]
      END
      SCATTERING COEFFICIENT: SCATTERING COEFFICIENT
        Option = Value
        Scattering Coefficient = 0.0 [m^-1]
      END
      ABSORPTION COEFFICIENT: ABSORPTION COEFFICIENT
        Absorption Coefficient = 1.0 [m^-1]
        Option = Value
      END
      THERMAL CONDUCTIVITY: THERMAL CONDUCTIVITY
        Option = Value
        Thermal Conductivity = 470E-04 [W m^-1 K^-1]
      END
      EQUATION OF STATE: EQUATION OF STATE
        Molar Mass = 16.00 [kg kmol^-1]
        Option = Ideal Gas
      END
    END
  END
END

LIBRARY:
  &replace REACTION: Thermal NO O Radical PDF
    Reaction Description = Thermal NO Formation based on O Radicals with \
Temperature PDF
    Option = Single Step
    REACTANTS: REACTANTS
      Option = Child Materials
      Materials List = N2, O
      CHILD MATERIAL: N2
        Option = Stoichiometric
        Stoichiometric Coefficient = 1.0
        Reaction Order = 1.0
      END
      CHILD MATERIAL: O
        Option = Stoichiometric
        Stoichiometric Coefficient = 2.0
        Reaction Order = 1.0
      END
    END
    PRODUCTS: PRODUCTS
      Option = Child Materials
      Materials List = NO
      CHILD MATERIAL: NO
        Option = Stoichiometric
        Stoichiometric Coefficient = 2.0
      END
    END
    FORWARD REACTION RATE: FORWARD REACTION RATE
      Option = Arrhenius with Temperature PDF
      Lower Temperature = 300 [K]
      Upper Temperature = 2300 [K]
      Temperature Exponent = 0
      Pre Exponential Factor = 1.8E+11 [kmol^-1 m^3 s^-1]
      REACTION ACTIVATION: REACTION ACTIVATION
        Option = Activation Temperature
        Activation Temperature = 38370 [K]
      END
    END
    COMBUSTION MODEL: COMBUSTION MODEL
      Option = Finite Rate Chemistry
    END
  END
END
> update

LIBRARY:
  &replace   REACTION: NO Formation Methane PDF
    Object Origin = User
    Option = Multi Step
    Reaction Description = NO Formation with Temperature PDF for Methane
    Reactions List = Prompt NO Methane PDF,Thermal NO O Radical PDF
  END # REACTION:NO Formation Methane PDF
END # LIBRARY:
> update

&replace CFX RIF: CFX RIF CH4at300K
  Fuel Module = CH4
  Kinetic Scheme = C1 mechanism without NOx
  Library File = Methane300K
  FUEL COMPOSITION:
    COMPONENT: CH4
      Mass Fraction = 1.0
      Option = Mass Fraction
    END # COMPONENT:CH4
    COMPONENT: CO2
      Mass Fraction = 0.0
      Option = Mass Fraction
    END # COMPONENT:CO2
    COMPONENT: H2O
      Mass Fraction = 0.0
      Option = Mass Fraction
    END # COMPONENT:H2O
    COMPONENT: N2
      Mass Fraction = 0.0
      Option = Mass Fraction
    END # COMPONENT:N2
  END # FUEL COMPOSITION:
  LEWIS NUMBERS:
    Option = Unity
  END # LEWIS NUMBERS:
  MIXTURE FRACTION:
    Option = Non Uniform
    Table Points = 100
  END # MIXTURE FRACTION:
  MIXTURE FRACTION VARIANCE:
    Option = Uniform Normalised Variance
    Table Points = 10
  END # MIXTURE FRACTION VARIANCE:
  OXIDISER COMPOSITION:
    COMPONENT: CO2
      Mass Fraction = 0.0
      Option = Mass Fraction
    END # COMPONENT:CO2
    COMPONENT: H2O
      Mass Fraction = 0.0
      Option = Mass Fraction
    END # COMPONENT:H2O
    COMPONENT: N2
      Mass Fraction = 0.767
      Option = Mass Fraction
    END # COMPONENT:N2
    COMPONENT: O2
      Mass Fraction = 0.233
      Option = Mass Fraction
    END # COMPONENT:O2
  END # OXIDISER COMPOSITION:
  PRESSURE AND TEMPERATURE:
    Fuel Temperature = 300 [K]
    Oxidiser Temperature = 300 [K]
    Reference Pressure = 1 [atm]
  END # PRESSURE AND TEMPERATURE:
  SCALAR DISSIPATION RATE:
    Lower Scalar Dissipation Rate = 1.0E-2 [s^-1]
    Maximum Scalar Dissipation Rate = 10 [s^-1]
    Option = Logarithmic
    Table Points = 20
  END # SCALAR DISSIPATION RATE:
END # CFX RIF:CFX RIF CH4at300K
> update

>startExternalProcess, application=CFXRIF, cclpath=/CFX RIF:CFX RIF CH4at300K, overwrite = yes
> update

LIBRARY:
  &replace   MATERIAL: Methane Air Mixture
    Material Group = Gas Phase Combustion
    Object Origin = User
    Option = Reacting Mixture
    Reactions List = Methane300K
    MIXTURE PROPERTIES:
      Option = Ideal Mixture
      ABSORPTION COEFFICIENT:
        Absorption Coefficient = 1.0 [m^-1]
        Option = Value
      END # ABSORPTION COEFFICIENT:
      REFRACTIVE INDEX:
        Option = Value
        Refractive Index = 1.0
      END # REFRACTIVE INDEX:
      SCATTERING COEFFICIENT:
        Option = Value
        Scattering Coefficient = 0. [m^-1]
      END # SCATTERING COEFFICIENT:
    END # MIXTURE PROPERTIES:
  END # MATERIAL:Methane Air Mixture
END # LIBRARY:
> update

FLOW: Flow Analysis 1
  &replace   DOMAIN: Default Domain
    Coord Frame = Coord 0
    Domain Type = Fluid
    Location = B152,B153,B154,B155,B156
    BOUNDARY: Default Domain Default
      Boundary Type = WALL
      Create Other Side = Off
      Interface Boundary = Off
      Location = F127.152,F130.153,F133.153,F135.154,F139.154,F142.155,\
F144.155,F148.156,F151.156,F158.152,F159.152,F160.152,F162.152,F163.152,F165.152,\
F167.152,F168.152,F170.152,F172.152,F174.152,F175.152,F181.152,F182.152,F183.152,\
F184.152,F185.152
      BOUNDARY CONDITIONS:
        HEAT TRANSFER:
          Option = Adiabatic
        END # HEAT TRANSFER:
        MASS AND MOMENTUM:
          Option = No Slip Wall
        END # MASS AND MOMENTUM:
        THERMAL RADIATION:
          Diffuse Fraction = 1.
          Emissivity = 1.
          Option = Opaque
        END # THERMAL RADIATION:
        WALL ROUGHNESS:
          Option = Smooth Wall
        END # WALL ROUGHNESS:
      END # BOUNDARY CONDITIONS:
    END # BOUNDARY:Default Domain Default
    BOUNDARY: airin
      Boundary Type = INLET
      Interface Boundary = Off
      Location = airin
      BOUNDARY CONDITIONS:
        COMPONENT: CH4
          Mass Fraction = 0.0
          Option = Mass Fraction
        END # COMPONENT:CH4
        COMPONENT: CO2
          Mass Fraction = 0.0
          Option = Mass Fraction
        END # COMPONENT:CO2
        COMPONENT: H2O
          Mass Fraction = 0.0
          Option = Mass Fraction
        END # COMPONENT:H2O
        COMPONENT: NO
          Mass Fraction = 0.0
          Option = Mass Fraction
        END # COMPONENT:NO
        COMPONENT: O2
          Mass Fraction = 0.232
          Option = Mass Fraction
        END # COMPONENT:O2
        FLOW REGIME:
          Option = Subsonic
        END # FLOW REGIME:
        HEAT TRANSFER:
          Option = Static Temperature
          Static Temperature = 300 [K]
        END # HEAT TRANSFER:
        MASS AND MOMENTUM:
          Normal Speed = 10 [m s^-1]
          Option = Normal Speed
        END # MASS AND MOMENTUM:
        THERMAL RADIATION:
          Option = Local Temperature
        END # THERMAL RADIATION:
        TURBULENCE:
          Option = Medium Intensity and Eddy Viscosity Ratio
        END # TURBULENCE:
      END # BOUNDARY CONDITIONS:
    END # BOUNDARY:airin
    BOUNDARY: fuelin
      Boundary Type = INLET
      Interface Boundary = Off
      Location = fuelin
      BOUNDARY CONDITIONS:
        COMPONENT: CH4
          Mass Fraction = 1
          Option = Mass Fraction
        END # COMPONENT:CH4
        COMPONENT: CO2
          Mass Fraction = 0.0
          Option = Mass Fraction
        END # COMPONENT:CO2
        COMPONENT: H2O
          Mass Fraction = 0.0
          Option = Mass Fraction
        END # COMPONENT:H2O
        COMPONENT: NO
          Mass Fraction = 0.0
          Option = Mass Fraction
        END # COMPONENT:NO
        COMPONENT: O2
          Mass Fraction = 0.0
          Option = Mass Fraction
        END # COMPONENT:O2
        FLOW REGIME:
          Option = Subsonic
        END # FLOW REGIME:
        HEAT TRANSFER:
          Option = Static Temperature
          Static Temperature = 300 [K]
        END # HEAT TRANSFER:
        MASS AND MOMENTUM:
          Normal Speed = 40 [m s^-1]
          Option = Normal Speed
        END # MASS AND MOMENTUM:
        THERMAL RADIATION:
          Option = Local Temperature
        END # THERMAL RADIATION:
        TURBULENCE:
          Option = Medium Intensity and Eddy Viscosity Ratio
        END # TURBULENCE:
      END # BOUNDARY CONDITIONS:
    END # BOUNDARY:fuelin
    BOUNDARY: out
      Boundary Type = OUTLET
      Interface Boundary = Off
      Location = out
      BOUNDARY CONDITIONS:
        FLOW REGIME:
          Option = Subsonic
        END # FLOW REGIME:
        MASS AND MOMENTUM:
          Option = Average Static Pressure
          Pressure Profile Blend = 0.05
          Relative Pressure = 0 [Pa]
        END # MASS AND MOMENTUM:
        PRESSURE AVERAGING:
          Option = Average Over Whole Outlet
        END # PRESSURE AVERAGING:
        THERMAL RADIATION:
          Option = Local Temperature
        END # THERMAL RADIATION:
      END # BOUNDARY CONDITIONS:
    END # BOUNDARY:out
    BOUNDARY: secairin
      Boundary Type = INLET
      Interface Boundary = Off
      Location = secairin
      BOUNDARY CONDITIONS:
        COMPONENT: CH4
          Mass Fraction = 0.0
          Option = Mass Fraction
        END # COMPONENT:CH4
        COMPONENT: CO2
          Mass Fraction = 0.0
          Option = Mass Fraction
        END # COMPONENT:CO2
        COMPONENT: H2O
          Mass Fraction = 0.0
          Option = Mass Fraction
        END # COMPONENT:H2O
        COMPONENT: NO
          Mass Fraction = 0.0
          Option = Mass Fraction
        END # COMPONENT:NO
        COMPONENT: O2
          Mass Fraction = 0.232
          Option = Mass Fraction
        END # COMPONENT:O2
        FLOW REGIME:
          Option = Subsonic
        END # FLOW REGIME:
        HEAT TRANSFER:
          Option = Static Temperature
          Static Temperature = 300 [K]
        END # HEAT TRANSFER:
        MASS AND MOMENTUM:
          Normal Speed = 6 [m s^-1]
          Option = Normal Speed
        END # MASS AND MOMENTUM:
        THERMAL RADIATION:
          Option = Local Temperature
        END # THERMAL RADIATION:
        TURBULENCE:
          Option = Medium Intensity and Eddy Viscosity Ratio
        END # TURBULENCE:
      END # BOUNDARY CONDITIONS:
    END # BOUNDARY:secairin
    BOUNDARY: vanes
      Boundary Type = WALL
      Create Other Side = Off
      Interface Boundary = Off
      Location = Vane Surfaces,Vane Surfaces Other Side
      BOUNDARY CONDITIONS:
        HEAT TRANSFER:
          Option = Adiabatic
        END # HEAT TRANSFER:
        MASS AND MOMENTUM:
          Option = No Slip Wall
        END # MASS AND MOMENTUM:
        THERMAL RADIATION:
          Diffuse Fraction = 1.
          Emissivity = 1.
          Option = Opaque
        END # THERMAL RADIATION:
        WALL ROUGHNESS:
          Option = Smooth Wall
        END # WALL ROUGHNESS:
      END # BOUNDARY CONDITIONS:
    END # BOUNDARY:vanes
    DOMAIN MODELS:
      BUOYANCY MODEL:
        Option = Non Buoyant
      END # BUOYANCY MODEL:
      DOMAIN MOTION:
        Option = Stationary
      END # DOMAIN MOTION:
      MESH DEFORMATION:
        Option = None
      END # MESH DEFORMATION:
      REFERENCE PRESSURE:
        Reference Pressure = 1 [atm]
      END # REFERENCE PRESSURE:
    END # DOMAIN MODELS:
    FLUID DEFINITION: Fluid 1
      Material = Methane Air Mixture
      Option = Material Library
      MORPHOLOGY:
        Option = Continuous Fluid
      END # MORPHOLOGY:
    END # FLUID DEFINITION:Fluid 1
    FLUID MODELS:
      COMBUSTION MODEL:
        Option = Laminar Flamelet with PDF
        CHEMISTRY POST PROCESSING:
          Materials List = NO
          Reactions List = NO Formation Methane PDF
        END # CHEMISTRY POST PROCESSING:
      END # COMBUSTION MODEL:
      COMPONENT: CH
        Option = Automatic
      END # COMPONENT:CH
      COMPONENT: CH2O
        Option = Automatic
      END # COMPONENT:CH2O
      COMPONENT: CH3
        Option = Automatic
      END # COMPONENT:CH3
      COMPONENT: CH4
        Option = Automatic
      END # COMPONENT:CH4
      COMPONENT: CHO
        Option = Automatic
      END # COMPONENT:CHO
      COMPONENT: CO
        Option = Automatic
      END # COMPONENT:CO
      COMPONENT: CO2
        Option = Automatic
      END # COMPONENT:CO2
      COMPONENT: H
        Option = Automatic
      END # COMPONENT:H
      COMPONENT: H2
        Option = Automatic
      END # COMPONENT:H2
      COMPONENT: H2O
        Option = Automatic
      END # COMPONENT:H2O
      COMPONENT: H2O2
        Option = Automatic
      END # COMPONENT:H2O2
      COMPONENT: HO2
        Option = Automatic
      END # COMPONENT:HO2
      COMPONENT: N2
        Option = Constraint
      END # COMPONENT:N2
      COMPONENT: NO
        Option = Transport Equation
      END # COMPONENT:NO
      COMPONENT: O
        Option = Automatic
      END # COMPONENT:O
      COMPONENT: O2
        Option = Automatic
      END # COMPONENT:O2
      COMPONENT: OH
        Option = Automatic
      END # COMPONENT:OH
      COMPONENT: x3 CH2
        Option = Automatic
      END # COMPONENT:x3 CH2
      HEAT TRANSFER MODEL:
        Option = Thermal Energy
      END # HEAT TRANSFER MODEL:
      THERMAL RADIATION MODEL:
        Option = Discrete Transfer
        Radiation Transfer Mode = Participating Media
        SCATTERING MODEL:
          Option = None
        END # SCATTERING MODEL:
        SPECTRAL MODEL:
          Option = Gray
        END # SPECTRAL MODEL:
      END # THERMAL RADIATION MODEL:
      TURBULENCE MODEL:
        Option = k epsilon
      END # TURBULENCE MODEL:
      TURBULENT WALL FUNCTIONS:
        Option = Scalable
      END # TURBULENT WALL FUNCTIONS:
    END # FLUID MODELS:
  END # DOMAIN:Default Domain
END # FLOW:Flow Analysis 1
> update

FLOW: Flow Analysis 1
  DOMAIN: Default Domain
    &replace     BOUNDARY: fuelin
      Boundary Type = INLET
      Interface Boundary = Off
      Location = fuelin
      BOUNDARY CONDITIONS:
        COMPONENT: NO
          Mass Fraction = 0.0
          Option = Mass Fraction
        END # COMPONENT:NO
        FLOW REGIME:
          Option = Subsonic
        END # FLOW REGIME:
        HEAT TRANSFER:
          Option = Static Temperature
          Static Temperature = 300 [K]
        END # HEAT TRANSFER:
        MASS AND MOMENTUM:
          Normal Speed = 40 [m s^-1]
          Option = Normal Speed
        END # MASS AND MOMENTUM:
        MIXTURE:
          Option = Fuel
        END # MIXTURE:
        THERMAL RADIATION:
          Option = Local Temperature
        END # THERMAL RADIATION:
        TURBULENCE:
          Option = Medium Intensity and Eddy Viscosity Ratio
        END # TURBULENCE:
      END # BOUNDARY CONDITIONS:
    END # BOUNDARY:fuelin
  END # DOMAIN:Default Domain
END # FLOW:Flow Analysis 1
> update

FLOW: Flow Analysis 1
  DOMAIN: Default Domain
    &replace     BOUNDARY: airin
      Boundary Type = INLET
      Interface Boundary = Off
      Location = airin
      BOUNDARY CONDITIONS:
        COMPONENT: NO
          Mass Fraction = 0.0
          Option = Mass Fraction
        END # COMPONENT:NO
        FLOW REGIME:
          Option = Subsonic
        END # FLOW REGIME:
        HEAT TRANSFER:
          Option = Static Temperature
          Static Temperature = 300 [K]
        END # HEAT TRANSFER:
        MASS AND MOMENTUM:
          Normal Speed = 10 [m s^-1]
          Option = Normal Speed
        END # MASS AND MOMENTUM:
        MIXTURE:
          Option = Oxidiser
        END # MIXTURE:
        THERMAL RADIATION:
          Option = Local Temperature
        END # THERMAL RADIATION:
        TURBULENCE:
          Option = Medium Intensity and Eddy Viscosity Ratio
        END # TURBULENCE:
      END # BOUNDARY CONDITIONS:
    END # BOUNDARY:airin
  END # DOMAIN:Default Domain
END # FLOW:Flow Analysis 1
> update

FLOW: Flow Analysis 1
  DOMAIN: Default Domain
    &replace     BOUNDARY: secairin
      Boundary Type = INLET
      Interface Boundary = Off
      Location = secairin
      BOUNDARY CONDITIONS:
        COMPONENT: NO
          Mass Fraction = 0.0
          Option = Mass Fraction
        END # COMPONENT:NO
        FLOW REGIME:
          Option = Subsonic
        END # FLOW REGIME:
        HEAT TRANSFER:
          Option = Static Temperature
          Static Temperature = 300 [K]
        END # HEAT TRANSFER:
        MASS AND MOMENTUM:
          Normal Speed = 6 [m s^-1]
          Option = Normal Speed
        END # MASS AND MOMENTUM:
        MIXTURE:
          Option = Oxidiser
        END # MIXTURE:
        THERMAL RADIATION:
          Option = Local Temperature
        END # THERMAL RADIATION:
        TURBULENCE:
          Option = Medium Intensity and Eddy Viscosity Ratio
        END # TURBULENCE:
      END # BOUNDARY CONDITIONS:
    END # BOUNDARY:secairin
  END # DOMAIN:Default Domain
END # FLOW:Flow Analysis 1
> update

FLOW: Flow Analysis 1
  &replace   INITIALISATION:
    Option = Automatic
    INITIAL CONDITIONS:
      Velocity Type = Cartesian
      CARTESIAN VELOCITY COMPONENTS:
        Option = Automatic with Value
        U = 0 [m s^-1]
        V = 0 [m s^-1]
        W = 5 [m s^-1]
      END # CARTESIAN VELOCITY COMPONENTS:
      COMPONENT: NO
        Mass Fraction = 0.0
        Option = Automatic with Value
      END # COMPONENT:NO
      MIXTURE FRACTION:
        Option = Automatic
      END # MIXTURE FRACTION:
      MIXTURE FRACTION VARIANCE:
        Option = Automatic
      END # MIXTURE FRACTION VARIANCE:
      RADIATION INTENSITY:
        Option = Automatic
      END # RADIATION INTENSITY:
      STATIC PRESSURE:
        Option = Automatic
      END # STATIC PRESSURE:
      TEMPERATURE:
        Option = Automatic
      END # TEMPERATURE:
      TURBULENCE INITIAL CONDITIONS:
        Option = Medium Intensity and Eddy Viscosity Ratio
      END # TURBULENCE INITIAL CONDITIONS:
    END # INITIAL CONDITIONS:
  END # INITIALISATION:
END # FLOW:Flow Analysis 1
> update

FLOW: Flow Analysis 1
  &replace   SOLVER CONTROL:
    Turbulence Numerics = First Order
    ADVECTION SCHEME:
      Option = High Resolution
    END # ADVECTION SCHEME:
    CONVERGENCE CONTROL:
      Maximum Number of Iterations = 100
      Minimum Number of Iterations = 1
      Physical Timescale = 0.025 [s]
      Timescale Control = Physical Timescale
    END # CONVERGENCE CONTROL:
    CONVERGENCE CRITERIA:
      Residual Target = 1.E-4
      Residual Type = RMS
    END # CONVERGENCE CRITERIA:
    DYNAMIC MODEL CONTROL:
      Global Dynamic Model Control = On
    END # DYNAMIC MODEL CONTROL:
    THERMAL RADIATION CONTROL:
      Iteration Interval = 10
    END # THERMAL RADIATION CONTROL:
  END # SOLVER CONTROL:
END # FLOW:Flow Analysis 1
> update

>writeCaseFile filename=CombustorFlamelet.def,operation=\
write def file

>writeCaseFile

# Subroutine for copying the file
!no warnings 'redefine';
! sub getEgFile {
!       my $egdir;

!       my @files = @_;
!       foreach my $file (@files) {
                 # Skip if the file exists already
!                next if -e $file;
!                unless ($egdir = $ENV{"CFX_EG_DIR"}) {
!                        die "Examples directory variable CFX_EG_DIR not set.";
!                }
                 # Use backslash if it's a windows filepath
!                my $workdir = cwd();
!                if ($egdir =~ /\\/) {
!                       my $egfile = "$egdir\\$file";
!                       copy($egfile,".") || die "\nThe tutorial file \"$file\" was not found in the working directory. Please populate the working directory (\"$workdir\") with the required files as described in the tutorial.\n";
!                }
                 # Or a forward slash if it's Unix
!                else {
!                       my $egfile = "$egdir\/$file";
!                       copy($egfile,".") || die "\nThe tutorial file \"$file\" was not found in the working directory. Please populate the working directory (\"$workdir\") with the required files as described in the tutorial.\n";
!                }
!
!       }
! }




