sort-demos.sh 773 B

123456789101112131415161718192021222324252627282930
  1. #!/bin/bash
  2. # When scanning for demos, the project manager sorts them based on their
  3. # timestamp, i.e. last modification date. This can make for a pretty
  4. # messy output, so this script 'touches' each project.godot file in reverse
  5. # alphabetical order to ensure a nice listing.
  6. #
  7. # It's good practice to run it once before packaging demos on the build
  8. # server.
  9. if [ ! -d "demos" ]; then
  10. echo "Run this script from the root directory where 'demos/' is contained."
  11. exit 1
  12. fi
  13. if [ -e demos.list ]; then
  14. rm -f demos.list
  15. fi
  16. for dir in 2d 3d gui misc viewport; do
  17. find "demos/$dir" -name "project.godot" |sort >> demos.list
  18. done
  19. cat demos.list |sort -r > demos_r.list
  20. while read line; do
  21. touch $line
  22. sleep 0.2
  23. done < demos_r.list
  24. #rm -f demos.list demos_r.list