godot/misc/scripts/sort-demos.sh
Rémi Verschelde 7ce8342ac5 Rename project file to "project.godot"
Slimmed down variant from the reverted #8375.
The rationale behind the name change is to give Godot's project file a unique
extension (".godot") that can be registered on the OS to be associated with
the Godot binary (OS registration not implemented here).

This PR also adds the possibility to start the game or editor if launched
with the project.godot passed as argument, which paves the way for allowing
a similar behaviour on a double-click in the OS file manager (code originally
by @Hinsbart).

Closes #6915.
2017-05-01 17:50:19 +02:00

30 lines
773 B
Bash

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