mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-28 17:51:15 -03:00
Work on new history implementation
This commit is contained in:
39
path.cpp
39
path.cpp
@@ -471,8 +471,47 @@ wchar_t *path_get_config( void *context)
|
||||
{
|
||||
debug( 0, _(L"Unable to create a configuration directory for fish. Your personal settings will not be saved. Please set the $XDG_CONFIG_HOME variable to a directory where the current user has write access." ));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool path_get_config(wcstring &path)
|
||||
{
|
||||
int done = 0;
|
||||
wcstring res;
|
||||
|
||||
const env_var_t xdg_dir = env_get_string( L"XDG_CONFIG_HOME" );
|
||||
if( ! xdg_dir.missing() )
|
||||
{
|
||||
res = xdg_dir + L"/fish";
|
||||
if( !create_directory( res.c_str() ) )
|
||||
{
|
||||
done = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const env_var_t home = env_get_string( L"HOME" );
|
||||
if( ! home.missing() )
|
||||
{
|
||||
res = home + L"/.config/fish";
|
||||
if( !create_directory( res.c_str() ) )
|
||||
{
|
||||
done = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( done )
|
||||
{
|
||||
path = res;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
debug( 0, _(L"Unable to create a configuration directory for fish. Your personal settings will not be saved. Please set the $XDG_CONFIG_HOME variable to a directory where the current user has write access." ));
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
wchar_t *path_make_canonical( void *context, const wchar_t *path )
|
||||
|
||||
Reference in New Issue
Block a user