Load shaders relative to the game directory, rather than the CWD.

If OpenRA is started with a current working directory that does not match the path to the game, then loading shaders will fail. By using a path relative to the game directory, we can successfully start the game with different working directories.
This commit is contained in:
RoosterDragon
2015-12-23 19:11:10 +00:00
parent 387d0d0e3f
commit c25fe32c9e

View File

@@ -25,7 +25,7 @@ namespace OpenRA.Platforms.Default
protected int CompileShaderObject(ShaderType type, string name)
{
var ext = type == ShaderType.VertexShader ? "vert" : "frag";
var filename = "glsl{0}{1}.{2}".F(Path.DirectorySeparatorChar, name, ext);
var filename = Path.Combine(Platform.GameDir, "glsl", name + "." + ext);
var code = File.ReadAllText(filename);
var shader = GL.CreateShader(type);