Work on new history implementation

This commit is contained in:
ridiculousfish
2012-02-05 16:42:24 -08:00
parent 7fcf25a78f
commit 5ad6849d4e
16 changed files with 789 additions and 194 deletions

View File

@@ -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 )