Skip to content

Commit 4d4ed13

Browse files
check if /usr/share/fonts exists
shoutout to NixOS package maintainer for finding this one
1 parent 18b1b8f commit 4d4ed13

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

trigger-control.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -537,16 +537,17 @@ int main(int argc, char **argv)
537537
#endif
538538
#ifdef __linux__
539539
// probably should work for all distros
540-
for (auto file : std::filesystem::recursive_directory_iterator("/usr/share/fonts/"))
541-
{
542-
if (file.is_directory())
543-
continue;
544-
if (file.path().filename() == "DejaVuSans.ttf")
540+
if(std::filesystem::exists("/usr/share/fonts"))
541+
for (auto file : std::filesystem::recursive_directory_iterator("/usr/share/fonts/"))
545542
{
546-
io.Fonts->AddFontFromFileTTF(file.path().c_str(), 18.0f * dpi_scaling, NULL, ranges.Data);
547-
break;
543+
if (file.is_directory())
544+
continue;
545+
if (file.path().filename() == "DejaVuSans.ttf")
546+
{
547+
io.Fonts->AddFontFromFileTTF(file.path().c_str(), 18.0f * dpi_scaling, NULL, ranges.Data);
548+
break;
549+
}
548550
}
549-
}
550551
#endif
551552
int preset_index = 0;
552553
SDL_GameController *handle;

0 commit comments

Comments
 (0)