65 lines
1.9 KiB
Zig
65 lines
1.9 KiB
Zig
const std = @import("std");
|
|
pub const c = @import("c.zig").c;
|
|
|
|
pub const Time = i64;
|
|
|
|
pub inline fn getBasePath() [*c]const u8 {
|
|
return c.SDL_GetBasePath();
|
|
}
|
|
|
|
pub inline fn getPrefPath(org: [*c]const u8, app: [*c]const u8) [*c]u8 {
|
|
return c.SDL_GetPrefPath(org, app);
|
|
}
|
|
|
|
pub inline fn getUserFolder(folder: Folder) [*c]const u8 {
|
|
return c.SDL_GetUserFolder(folder);
|
|
}
|
|
|
|
pub const PathInfo = extern struct {
|
|
type: PathType, // the path type
|
|
size: u64, // the file size in bytes
|
|
create_time: Time, // the time when the path was created
|
|
modify_time: Time, // the last time the path was modified
|
|
access_time: Time, // the last time the path was read
|
|
};
|
|
|
|
pub const GlobFlags = packed struct(u32) {
|
|
globCaseinsensitive: bool = false,
|
|
pad0: u30 = 0,
|
|
rsvd: bool = false,
|
|
};
|
|
|
|
pub inline fn createDirectory(path: [*c]const u8) bool {
|
|
return c.SDL_CreateDirectory(path);
|
|
}
|
|
|
|
pub const EnumerateDirectoryCallback = *const fn (userdata: ?*anyopaque, dirname: [*c]const u8, fname: [*c]const u8) callconv(.C) EnumerationResult;
|
|
|
|
pub inline fn enumerateDirectory(path: [*c]const u8, callback: EnumerateDirectoryCallback, userdata: ?*anyopaque) bool {
|
|
return c.SDL_EnumerateDirectory(path, callback, userdata);
|
|
}
|
|
|
|
pub inline fn removePath(path: [*c]const u8) bool {
|
|
return c.SDL_RemovePath(path);
|
|
}
|
|
|
|
pub inline fn renamePath(oldpath: [*c]const u8, newpath: [*c]const u8) bool {
|
|
return c.SDL_RenamePath(oldpath, newpath);
|
|
}
|
|
|
|
pub inline fn copyFile(oldpath: [*c]const u8, newpath: [*c]const u8) bool {
|
|
return c.SDL_CopyFile(oldpath, newpath);
|
|
}
|
|
|
|
pub inline fn getPathInfo(path: [*c]const u8, info: ?*PathInfo) bool {
|
|
return c.SDL_GetPathInfo(path, info);
|
|
}
|
|
|
|
pub inline fn globDirectory(path: [*c]const u8, pattern: [*c]const u8, flags: GlobFlags, count: *c_int) [*c][*c]u8 {
|
|
return c.SDL_GlobDirectory(path, pattern, @bitCast(flags), @ptrCast(count));
|
|
}
|
|
|
|
pub inline fn getCurrentDirectory() [*c]u8 {
|
|
return c.SDL_GetCurrentDirectory();
|
|
}
|