how do you determine the version of godot from a project directory

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By RobKohr

I am looking for an automated way to look at a godot project in a github repo and be able to identify what version of godot it is meant to run on.
Looking at these files:

I see both have format=2 in them, and they are both 3.x projects.

This is also a 3.x project, but as a plug in, it doesn’t have a .tres or a .tscn file. Looking at:

it has config_version=3

Also, this one has a project.godot with a config_version=3 for godot 3.x:
https://github.com/henriquelalves/SimpleGodotCRTShader/blob/master/godot3/project.godot
and for a godot 2.x version of the same project (which doesn’t have a project.godot):
https://github.com/henriquelalves/SimpleGodotCRTShader/blob/master/godot2/engine.cfg
there is no config_version

There is also a 2.x version of the project under another tag:

which has a scene in it with a format=1

It’s cfg file has no config version

Here is another that is a 2.x version where the scene file is format=1


Rules?

So the best I can come up with for rules is:
In tres or tscn files, take the format and add 1 to it to find the rough godot version (2.x or 3.x)

If there is a .cfg or a .godot file, and config_version=3, then it is 3.x, otherwise it is 2.x


Are there any other ways to test the version that a godot project should be labeled as? It would be nice to be able to get a more specific version number, like 3.1

The purpose of this all is to provide a way to scan a github repo and add it to this Godot Asset Store with meaningful version number flags.

:bust_in_silhouette: Reply From: Zylann

I think there is no way to tell just from the project file. It has a version but it’s only guaranteed to work for that file in particular (i.e if a new version of Godot does not change settings it will have the same number).

And it’s even harder to tell from the rest of the project… some other files have a version in them but that version only pertains to those in particular and not the engine in general. You could combine all such files to deduce the version but it’s quite sloppy.

If you aim to make a system that opens the project automatically with a version of Godot, you can only take the latest version using the project file version.

See Displaying versions of projects in Project Manager · Issue #25497 · godotengine/godot · GitHub