mirror of
https://github.com/fairyglade/ly.git
synced 2025-12-20 19:24:53 +00:00
Create xauth directory if it doesn't exist
Signed-off-by: AnErrupTion <anerruption@disroot.org>
This commit is contained in:
@@ -342,7 +342,7 @@ fn createXauthFile(pwd: []const u8, buffer: []u8) ![]const u8 {
|
|||||||
dir.close();
|
dir.close();
|
||||||
|
|
||||||
// xauth_dir is a directory, use it to store Xauthority
|
// xauth_dir is a directory, use it to store Xauthority
|
||||||
xauth_dir = try std.fmt.bufPrint(&xauth_buf, "{s}/ly", .{xauth_dir});
|
xauth_dir = try std.fmt.bufPrint(&xauth_buf, "{s}/.config/ly", .{pwd});
|
||||||
} else {
|
} else {
|
||||||
xauth_dir = try std.fmt.bufPrint(&xauth_buf, "{s}/ly", .{xdg_cfg_home.?});
|
xauth_dir = try std.fmt.bufPrint(&xauth_buf, "{s}/ly", .{xdg_cfg_home.?});
|
||||||
}
|
}
|
||||||
@@ -365,6 +365,9 @@ fn createXauthFile(pwd: []const u8, buffer: []u8) ![]const u8 {
|
|||||||
const trimmed_xauth_dir = xauth_dir[0 .. i + 1];
|
const trimmed_xauth_dir = xauth_dir[0 .. i + 1];
|
||||||
|
|
||||||
const xauthority: []u8 = try std.fmt.bufPrint(buffer, "{s}/{s}", .{ trimmed_xauth_dir, xauth_file });
|
const xauthority: []u8 = try std.fmt.bufPrint(buffer, "{s}/{s}", .{ trimmed_xauth_dir, xauth_file });
|
||||||
|
|
||||||
|
std.fs.makeDirAbsolute(trimmed_xauth_dir) catch {};
|
||||||
|
|
||||||
const file = try std.fs.createFileAbsolute(xauthority, .{});
|
const file = try std.fs.createFileAbsolute(xauthority, .{});
|
||||||
file.close();
|
file.close();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user