mirror of
https://github.com/Ascyii/projects.yazi.git
synced 2026-01-01 11:34:24 -05:00
fix: fix the default location of projects.json under unix
This commit is contained in:
25
README.md
25
README.md
@@ -90,7 +90,9 @@ The following are the default configurations:
|
|||||||
require("projects"):setup({
|
require("projects"):setup({
|
||||||
save = {
|
save = {
|
||||||
method = "yazi", -- yazi | lua
|
method = "yazi", -- yazi | lua
|
||||||
lua_save_path = "", -- windows: "%APPDATA%/yazi/state/projects.json", unix: "~/.config/yazi/state/projects.json"
|
lua_save_path = "", -- comment out to get the default value
|
||||||
|
-- windows: "%APPDATA%/yazi/state/projects.json"
|
||||||
|
-- unix: "~/.local/state/yazi/projects.json"
|
||||||
},
|
},
|
||||||
last = {
|
last = {
|
||||||
update_after_save = true,
|
update_after_save = true,
|
||||||
@@ -114,28 +116,31 @@ require("projects"):setup({
|
|||||||
> [!NOTE]
|
> [!NOTE]
|
||||||
> Yazi's api sometimes doesn't work on Windows, which is why the `lua` method is proposed
|
> Yazi's api sometimes doesn't work on Windows, which is why the `lua` method is proposed
|
||||||
|
|
||||||
`method` means the method of saving projects:
|
`method`: the method of saving projects:
|
||||||
- `yazi`: using `yazi` api to save to `.dds` file
|
- `yazi`: using `yazi` api to save to `.dds` file
|
||||||
- `lua`: using Lua to save
|
- `lua`: using `lua` api to save
|
||||||
|
|
||||||
`lua_save_path` means the path of saved file with lua api, the defalut is
|
`lua_save_path`: the path of saved file with lua api, the defalut is
|
||||||
- `Windows`: `%APPDATA%/yazi/state/projects.json`
|
- `Windows`: `%APPDATA%/yazi/state/projects.json`
|
||||||
- `Unix`: `~/.config/yazi/state/projects.json`
|
- `Unix`: `~/.local/state/yazi/projects.json`
|
||||||
|
|
||||||
### `last`
|
### `last`
|
||||||
|
|
||||||
The last project is loaded by `load_last` command.
|
The last project is loaded by `load_last` command.
|
||||||
|
|
||||||
When `update_after_save` enabled, the saved project will be saved to last project.
|
`update_after_save`: the saved project will be saved to last project.
|
||||||
When `update_after_load` enabled, the loaded project will be saved to last project.
|
|
||||||
When `load_after_start` enabled, the last project will be loaded after starting.
|
`update_after_load`: the loaded project will be saved to last project.
|
||||||
|
|
||||||
|
`load_after_start`: the last project will be loaded after starting.
|
||||||
|
- Only work with `lua` method, please refer to [#2](https://github.com/MasouShizuka/projects.yazi/issues/2)
|
||||||
|
|
||||||
### `merge`
|
### `merge`
|
||||||
|
|
||||||
When `quit_after_merge` enabled, the merged project will be exited after merging.
|
`quit_after_merge`: the merged project will be exited after merging.
|
||||||
|
|
||||||
### `notify`
|
### `notify`
|
||||||
|
|
||||||
When enabled, notifications will be shown when the user saves/loads/deletes/merges a project and deletes all projects.
|
When enabled, notifications are displayed when actions are performed.
|
||||||
|
|
||||||
`title`, `timeout`, `level` are the same as [ya.notify](https://yazi-rs.github.io/docs/plugins/utils/#ya.notify).
|
`title`, `timeout`, `level` are the same as [ya.notify](https://yazi-rs.github.io/docs/plugins/utils/#ya.notify).
|
||||||
|
|||||||
5
init.lua
5
init.lua
@@ -528,11 +528,10 @@ local _load_config = ya.sync(function(state, args)
|
|||||||
else
|
else
|
||||||
local lua_save_path
|
local lua_save_path
|
||||||
local appdata = os.getenv("APPDATA")
|
local appdata = os.getenv("APPDATA")
|
||||||
local postfix = "/yazi/state/projects.json"
|
|
||||||
if appdata then
|
if appdata then
|
||||||
lua_save_path = appdata:gsub("\\", "/") .. postfix
|
lua_save_path = appdata:gsub("\\", "/") .. "/yazi/state/projects.json"
|
||||||
else
|
else
|
||||||
lua_save_path = os.getenv("HOME") .. postfix
|
lua_save_path = os.getenv("HOME") .. "/.local/state/yazi/projects.json"
|
||||||
end
|
end
|
||||||
|
|
||||||
state.save.lua_save_path = lua_save_path
|
state.save.lua_save_path = lua_save_path
|
||||||
|
|||||||
Reference in New Issue
Block a user