mirror of
https://github.com/libretro/RetroArch
synced 2025-04-09 21:45:45 +00:00
(UWP) UWP cannot deal with relative paths, turn them into absolute
paths first before reading shader pass files
This commit is contained in:
parent
a162613a16
commit
8b0f083a4e
@ -46,15 +46,26 @@ bool glslang_read_shader_file(const char *path, vector<string> *output, bool roo
|
|||||||
char *buf = nullptr;
|
char *buf = nullptr;
|
||||||
int64_t len = 0;
|
int64_t len = 0;
|
||||||
const char *basename = path_basename(path);
|
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';
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(tmp_path);
|
||||||
|
|
||||||
/* Remove Windows \r chars if we encounter them.
|
/* Remove Windows \r chars if we encounter them.
|
||||||
* filestream_read_file() allocates one extra for 0 terminator. */
|
* filestream_read_file() allocates one extra for 0 terminator. */
|
||||||
auto itr = remove_if(buf, buf + len + 1, [](char c) {
|
auto itr = remove_if(buf, buf + len + 1, [](char c) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user