From 7380c789e0c9ae6c2ebc0bfd85badde28bb3f477 Mon Sep 17 00:00:00 2001 From: Ted John Date: Mon, 16 Jan 2017 22:46:59 +0000 Subject: [PATCH] Implement platform_get_absolute_path for Windows --- src/openrct2/platform/windows.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/openrct2/platform/windows.c b/src/openrct2/platform/windows.c index cc528147ab..b35896a688 100644 --- a/src/openrct2/platform/windows.c +++ b/src/openrct2/platform/windows.c @@ -1057,6 +1057,26 @@ bool platform_get_font_path(TTFFontDescriptor *font, utf8 *buffer, size_t size) #endif } +char * platform_get_absolute_path(const utf8 * relativePath, const utf8 * basePath) +{ + utf8 path[MAX_PATH]; + safe_strcpy(path, basePath, sizeof(path)); + safe_strcat_path(path, relativePath, sizeof(path)); + + wchar_t * pathW = utf8_to_widechar(path); + wchar_t fullPathW[MAX_PATH]; + DWORD fullPathLen = GetFullPathNameW(pathW, countof(fullPathW), fullPathW, NULL); + + free(pathW); + + if (fullPathLen == 0) + { + return NULL; + } + + return widechar_to_utf8(fullPathW); +} + datetime64 platform_get_datetime_now_utc() { // Get file time