fix too long path
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/02/02 21:59:20 by tomoron #+# #+# */
|
||||
/* Updated: 2024/05/03 14:19:08 by tomoron ### ########.fr */
|
||||
/* Updated: 2024/05/06 13:14:50 by tomoron ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -31,12 +31,13 @@ char *get_prompt(t_env *env)
|
||||
res = ft_strjoin_free(res, ft_get_color(80, 80, 255), 3);
|
||||
res = ft_strjoin_free(res, "\033[1m\002", 1);
|
||||
cwd = getcwd(cwd_buffer, 99);
|
||||
if (ft_get_env(env, "HOME") && !ft_strncmp(cwd_buffer, ft_get_env(env,
|
||||
"HOME"), ft_strlen(ft_get_env(env, "HOME"))))
|
||||
if (cwd && ft_get_env(env, "HOME") && !ft_strncmp(cwd_buffer,
|
||||
ft_get_env(env,"HOME"), ft_strlen(ft_get_env(env, "HOME"))))
|
||||
{
|
||||
cwd += ft_strlen(getenv("HOME")) - 1;
|
||||
cwd[0] = '~';
|
||||
}
|
||||
if(cwd)
|
||||
res = ft_strjoin_free(res, cwd, 1);
|
||||
res = ft_strjoin_free(res, "\001\033[0m\002$ ", 1);
|
||||
return (res);
|
||||
|
Reference in New Issue
Block a user