Skip to content

Commit

Permalink
Do not write empty data when starting
Browse files Browse the repository at this point in the history
  • Loading branch information
metalinspired committed Oct 31, 2024
1 parent e36ce90 commit 65159d3
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions lua/harpoon/data.lua
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,7 @@ local function read_data(config, provided_path)
provided_path = provided_path or fullpath(config)
local path = Path:new(provided_path)
local exists = path:exists()

if not exists then
write_data({}, config)
end

local out_data = path:read()

if not out_data or out_data == "" then
write_data({}, config)
out_data = "{}"
end

local out_data = exists and path:read() or "{}"
local data = vim.json.decode(out_data)
return data
end
Expand Down

0 comments on commit 65159d3

Please sign in to comment.