mirror of
https://github.com/fairyglade/ly.git
synced 2026-08-07 05:32:02 +00:00
Decouple save file path from config directory (closes #1025)
Signed-off-by: AnErrupTion <anerruption@disroot.org>
This commit is contained in:
@@ -80,7 +80,7 @@ margin_box_v: u8 = 1,
|
||||
numlock: bool = false,
|
||||
path: ?[]const u8 = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
|
||||
restart_key: ?[]const u8 = "F2",
|
||||
save: bool = true,
|
||||
save_file_dir: ?[]const u8 = build_options.config_directory ++ "/ly",
|
||||
service_name: [:0]const u8 = "ly",
|
||||
session_log: ?[]const u8 = "ly-session.log",
|
||||
setup_cmd: []const u8 = build_options.config_directory ++ "/ly/setup.sh",
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// Properties removed or changed since 0.6.0
|
||||
// Color codes interpreted differently since 1.1.0
|
||||
|
||||
const build_options = @import("build_options");
|
||||
const std = @import("std");
|
||||
var temporary_allocator = std.heap.page_allocator;
|
||||
|
||||
@@ -194,6 +195,19 @@ pub fn configFieldHandler(_: std.mem.Allocator, field: ini.IniField) ?ini.IniFie
|
||||
return null;
|
||||
}
|
||||
|
||||
if (std.mem.eql(u8, field.key, "save")) {
|
||||
// The option now uses a string for the file's parent directory
|
||||
var mapped_field = field;
|
||||
|
||||
if (std.mem.eql(u8, field.value, "true")) {
|
||||
mapped_field.value = build_options.config_directory ++ "/ly";
|
||||
} else if (std.mem.eql(u8, field.value, "false")) {
|
||||
mapped_field.value = "null";
|
||||
}
|
||||
|
||||
return mapped_field;
|
||||
}
|
||||
|
||||
// TODO: Dearest Melpert,
|
||||
// I pray this message finds you well, as daylight dwindles and the witching hour
|
||||
// approaches, I find it more and more imperative as time continues that I place
|
||||
|
||||
Reference in New Issue
Block a user