(UWP) UWP cannot deal with relative paths, turn them into absolute

paths first before reading shader pass files
This commit is contained in:
twinaphex 2019-05-02 18:24:19 +02:00
parent a162613a16
commit 8b0f083a4e

View File

@ -46,15 +46,26 @@ bool glslang_read_shader_file(const char *path, vector<string> *output, bool roo
char *buf = nullptr;
int64_t len = 0;
const char *basename = path_basename(path);
size_t path_size = PATH_MAX_LENGTH * sizeof(char);
char *tmp_path = (char*)malloc(path_size);
include_path[0] = tmp[0] = '\0';
if (!filestream_read_file(path, (void**)&buf, &len))
strlcpy(tmp_path, path, path_size);
path_resolve_realpath(tmp_path, path_size);
if (!path_is_valid(tmp_path))
strlcpy(tmp_path, path, path_size);
if (!filestream_read_file(tmp_path, (void**)&buf, &len))
{
RARCH_ERR("Failed to open shader file: \"%s\".\n", path);
RARCH_ERR("Failed to open shader file: \"%s\".\n", tmp_path);
free(tmp_path);
return false;
}
free(tmp_path);
/* Remove Windows \r chars if we encounter them.
* filestream_read_file() allocates one extra for 0 terminator. */
auto itr = remove_if(buf, buf + len + 1, [](char c) {