diff --git a/linux_4ed.cpp b/linux_4ed.cpp index 6cf30b31..ce43514c 100644 --- a/linux_4ed.cpp +++ b/linux_4ed.cpp @@ -284,6 +284,7 @@ internal int LinuxHandleToFD(Plat_Handle); internal void LinuxStringDup(String*, void*, size_t); internal void LinuxToggleFullscreen(Display*, Window); +internal void LinuxFatalErrorMsg(const char* msg); internal Sys_Acquire_Lock_Sig(system_acquire_lock); internal Sys_Release_Lock_Sig(system_release_lock); diff --git a/linux_font.cpp b/linux_font.cpp index e5f38d09..9f69b4ac 100644 --- a/linux_font.cpp +++ b/linux_font.cpp @@ -69,6 +69,16 @@ linux_font_load(Partition *part, Render_Font *rf, char *name, i32 pt_size, i32 t #endif if (filename != 0){ + struct stat st; + if(stat(filename, &st) == -1 || S_ISDIR(st.st_mode)){ + char buff[1024]; + + // NOTE(inso): if/when you can load fonts from anywhere, the message should be changed. + snprintf(buff, sizeof(buff), "Unable to load font '%s'. Make sure this file is in the same directory as the '4ed' executable.", filename); + LinuxFatalErrorMsg(buff); + exit(1); + } + result = font_load_freetype(part, rf, filename, pt_size, tab_width, use_hinting); }