Now really fixed path issue
This commit is contained in:
parent
527b72eddb
commit
bc8ad4693d
1 changed files with 4 additions and 2 deletions
|
@ -6,9 +6,11 @@ pub fn main() !void {
|
|||
defer _ = gpa.deinit();
|
||||
const allocator = gpa.allocator();
|
||||
|
||||
const username = std.os.getenv("USER");
|
||||
const env = try std.process.getEnvVarOwned(allocator, "USER");
|
||||
defer allocator.free(env);
|
||||
|
||||
const path = try std.fmt.allocPrint(allocator, "/home/{s}/.config/lister/data.json", .{username});
|
||||
const path = try std.fmt.allocPrint(allocator, "/home/{s}/.config/lister/data.json", .{env});
|
||||
defer allocator.free(path);
|
||||
|
||||
const file = try std.fs.cwd().openFile(path, .{});
|
||||
defer file.close();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue