Only display filename, not full path
This commit is contained in:
		| @@ -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; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user