Robitx/gp.nvim

The ChatToggle command will create a new chat on Windows.

ziboh opened this issue · 4 comments

Hi, This plugin is very greet.
When I use the ChatToggle command, a new chat will be created.
I took a look at the source code and found that the file last.md was created using the ln command.
However, The file last.md has not been created. Creating a Symbolic link on Windows requires administrator privileges.
So how should I proceed with the modifications? 🙏

@ziboh Thanks for the PR fix, I've just wrapped the \\ substitution so it's windows only

	if vim.fn.has("win32") then
		file_name = file_name:gsub("\\", "/")
		chat_dir = chat_dir:gsub("\\", "/")
	end

If you can confirm the latest version 3.5.1 is working fine, we can close this.

@Robitx Thank you for your Code Review. Some new issues have arisen now.
When I use the ChatDelete command to delete a conversation, And then use the ChatToggle command, I find that no new file is created, And the file linked to last.md is also the one that was just deleted.

If last.md does not have a valid path link, The window opened by ChatFinder command will show nothing.

@ziboh Thanks for the PR fix, I've just wrapped the \\ substitution so it's windows only

	if vim.fn.has("win32") then
		file_name = file_name:gsub("\\", "/")
		chat_dir = chat_dir:gsub("\\", "/")
	end

If you can confirm the latest version 3.5.1 is working fine, we can close this.

I think it would be best to directly modify the starts_with function, as I encountered a similar error when deleting sessions, and the error disappeared when I directly modified the starts_with function.

_H.starts_with = function(str, start)
	if vim.fn.has("win32") then
		str = str:gsub("\\", "/")
		start = start:gsub("\\", "/")
	end
	return str:sub(1, #start) == start
end

@ziboh could you please check latest version 3.7.0 which remembers last chat in state file instead of using symlinks?