Only display filename, not full path

This commit is contained in:
Nathan McRae 2023-06-21 20:18:10 -07:00
parent d3951dbc1d
commit 38ae10f9c6

View File

@ -139,7 +139,13 @@ pub fn main() !void {
defer file_docmaps.deinit(); defer file_docmaps.deinit();
for (file_paths.items) |path| { for (file_paths.items) |path| {
const surface: [*c]c.SDL_Surface = c.TTF_RenderText_Solid(font, @ptrCast([*c]const u8, path), text_color); var file_name: []const u8 = "";
var it = std.mem.tokenize(u8, path, std.fs.path.sep_str);
while (it.next()) |token| {
file_name = token;
}
const surface: [*c]c.SDL_Surface = c.TTF_RenderText_Solid(font, @ptrCast([*c]const u8, file_name), text_color);
if (surface == null) { if (surface == null) {
c.SDL_Log("Unable to render text"); c.SDL_Log("Unable to render text");
return error.RenderTextFailed; return error.RenderTextFailed;