Commit 14f90e50 authored by Gargaj's avatar Gargaj
Browse files

fix issue where windows folder isn't on C (fixes #112)

parent c26ed62b
......@@ -446,11 +446,11 @@ elseif (UNIX)
set(PLATFORM_LIBS GL)
elseif (WIN32)
if (${BONZOMATIC_WINDOWS_FLAVOR} MATCHES "DX11")
set(PLATFORM_LIBS d3d11 d3dcompiler dxguid DXGI winmm)
set(PLATFORM_LIBS d3d11 d3dcompiler dxguid DXGI winmm shlwapi)
elseif (${BONZOMATIC_WINDOWS_FLAVOR} MATCHES "DX9")
set(PLATFORM_LIBS d3d9 d3dx9 winmm)
set(PLATFORM_LIBS d3d9 d3dx9 winmm shlwapi)
else ()
set(PLATFORM_LIBS opengl32 glu32 winmm)
set(PLATFORM_LIBS opengl32 glu32 winmm shlwapi)
endif ()
endif ()
set(BZC_PROJECT_LIBS ${BZC_PROJECT_LIBS} ${PLATFORM_LIBS})
......
#include <string>
#include <Windows.h>
#include <tchar.h>
#include <Shlobj.h>
#include <Shlwapi.h>
#include <map>
......@@ -67,16 +69,23 @@ namespace Misc
const char * GetDefaultFontPath()
{
char windowsPath[ MAX_PATH ];
if ( SHGetFolderPath( NULL, CSIDL_WINDOWS, NULL, 0, windowsPath ) != S_OK )
{
return NULL;
}
const char* fontPaths[] =
{
"c:\\Windows\\Fonts\\cour.ttf",
"Fonts\\cour.ttf",
NULL
};
for (int i = 0; fontPaths[i]; ++i)
{
if (FileExists(fontPaths[i]))
static char fullPath[ MAX_PATH ] = { 0 };
PathCombineA( fullPath, windowsPath, fontPaths[ i ] );
if (FileExists( fullPath ))
{
return fontPaths[i];
return fullPath;
}
}
return NULL;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment