feat: add retain_symlinks option to enable writing files through links (default: true)
This commit is contained in:
parent
3a718bf6f6
commit
c0107e32e0
3 changed files with 15 additions and 1 deletions
|
|
@ -38,6 +38,8 @@ pub const BlameLine = struct {
|
|||
author_stamp: usize,
|
||||
};
|
||||
|
||||
pub var retain_symlinks: bool = true;
|
||||
|
||||
arena: std.heap.ArenaAllocator,
|
||||
allocator: Allocator,
|
||||
external_allocator: Allocator,
|
||||
|
|
@ -1599,7 +1601,14 @@ pub const StoreToFileError = error{
|
|||
WriteFailed,
|
||||
};
|
||||
|
||||
pub fn store_to_existing_file_const(self: *const Self, file_path: []const u8) StoreToFileError!void {
|
||||
pub fn store_to_existing_file_const(self: *const Self, file_path_: []const u8) StoreToFileError!void {
|
||||
var file_path = file_path_;
|
||||
var link_buf: [std.fs.max_path_bytes]u8 = undefined;
|
||||
if (retain_symlinks) blk: {
|
||||
const link = cwd().readLink(file_path, &link_buf) catch break :blk;
|
||||
file_path = link;
|
||||
}
|
||||
|
||||
var atomic = blk: {
|
||||
var write_buffer: [4096]u8 = undefined;
|
||||
const stat = cwd().statFile(file_path) catch
|
||||
|
|
|
|||
|
|
@ -89,6 +89,8 @@ keybind_mode: KeybindMode = .normal,
|
|||
dropdown_keybinds: DropdownKeybindMode = .standard,
|
||||
dropdown_limit: usize = 12,
|
||||
|
||||
retain_symlinks: bool = true,
|
||||
|
||||
include_files: []const u8 = "",
|
||||
|
||||
const default_actions = [_]IdleAction{.highlight_references};
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ const root = @import("soft_root").root;
|
|||
const tracy = @import("tracy");
|
||||
const builtin = @import("builtin");
|
||||
const file_link = @import("file_link");
|
||||
const Buffer = @import("Buffer");
|
||||
|
||||
pub const renderer = @import("renderer");
|
||||
const input = @import("input");
|
||||
|
|
@ -154,6 +155,8 @@ fn init(allocator: Allocator) InitError!*Self {
|
|||
|
||||
var conf, const conf_bufs = root.read_config(@import("config"), allocator);
|
||||
|
||||
Buffer.retain_symlinks = conf.retain_symlinks;
|
||||
|
||||
if (@hasDecl(renderer, "install_crash_handler") and conf.start_debugger_on_crash)
|
||||
renderer.jit_debugger_enabled = true;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue