From c25fe32c9ede37f163648d5903c68ab3a39c08ab Mon Sep 17 00:00:00 2001 From: RoosterDragon Date: Wed, 23 Dec 2015 19:11:10 +0000 Subject: [PATCH] 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. --- OpenRA.Platforms.Default/Shader.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenRA.Platforms.Default/Shader.cs b/OpenRA.Platforms.Default/Shader.cs index 840a5d2b8d..6e8653e1bd 100644 --- a/OpenRA.Platforms.Default/Shader.cs +++ b/OpenRA.Platforms.Default/Shader.cs @@ -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);