if (Test-Path env:COMSPEC) {
    $Env:YARP_DATA_DIRS = ($Env:YARP_DATA_DIRS.Split(';') | Where-Object { $_ -ne '$(Join-Path -Path $Env:CONDA_PREFIX -ChildPath Library\share\iCub)' }) -join ';'
    $Env:ROS_PACKAGE_PATH = ($Env:ROS_PACKAGE_PATH.Split(';') | Where-Object { $_ -ne '$(Join-Path -Path $Env:CONDA_PREFIX -ChildPath Library\share)' }) -join ';'
    $Env:AMENT_PREFIX_PATH = ($Env:AMENT_PREFIX_PATH.Split(';') | Where-Object { $_ -ne '$(Join-Path -Path $Env:CONDA_PREFIX -ChildPath Library)' }) -join ';'
}
else {
    $Env:YARP_DATA_DIRS = ($Env:YARP_DATA_DIRS.Split(';') | Where-Object { $_ -ne '$(Join-Path -Path $Env:CONDA_PREFIX -ChildPath share/iCub)' }) -join ';'
    $Env:ROS_PACKAGE_PATH = ($Env:ROS_PACKAGE_PATH.Split(';') | Where-Object { $_ -ne '$(Join-Path -Path $Env:CONDA_PREFIX -ChildPath share)' }) -join ';'
    $Env:AMENT_PREFIX_PATH = ($Env:AMENT_PREFIX_PATH.Split(';') | Where-Object { $_ -ne '$Env:CONDA_PREFIX' }) -join ';'
}


if (Test-Path env:COMSPEC) {
    $Env:GAZEBO_MODEL_PATH = ($Env:GAZEBO_MODEL_PATH.Split(';') | Where-Object { $_ -ne '$(Join-Path -Path $Env:CONDA_PREFIX -ChildPath Library\share\iCub\robots)' }) -join ';'
}
else {
    $Env:GAZEBO_MODEL_PATH = ($Env:GAZEBO_MODEL_PATH.Split(';') | Where-Object { $_ -ne '$(Join-Path -Path $Env:CONDA_PREFIX -ChildPath share/iCub/robots)' }) -join ';'
}


if (Test-Path env:COMSPEC) {
    $Env:GAZEBO_MODEL_PATH = ($Env:GAZEBO_MODEL_PATH.Split(';') | Where-Object { $_ -ne '$(Join-Path -Path $Env:CONDA_PREFIX -ChildPath Library\share)' }) -join ';'
}
else {
    $Env:GAZEBO_MODEL_PATH = ($Env:GAZEBO_MODEL_PATH.Split(';') | Where-Object { $_ -ne '$(Join-Path -Path $Env:CONDA_PREFIX -ChildPath share)' }) -join ';'
}

