#!/bin/bash

. /etc/profile

# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2020-present Shanti Gilbert (https://github.com/shantigilbert)
# Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS)

if [ -z "$UI_SHADER" ]; then
  option=".*\.\(glslp\|slangp\)$"
else
  option=".*\.\($UI_SHADER\)$"
fi

for dir in /tmp/shaders
do
  if [ -d "${dir}" ]; then
    find ${dir} -regex "${option}" -print0 |
      while IFS= read -r -d '' line; do
      echo ${line#${dir}/},
    done | sort
  fi
done
