Restore implicit cd for paths starting with ., .., or ~

This commit is contained in:
ridiculousfish
2012-06-02 14:04:25 -07:00
parent ae12e1b537
commit b7ba252965
6 changed files with 68 additions and 25 deletions

View File

@@ -1351,22 +1351,13 @@ static wchar_t * expand_tilde_internal_compat( wchar_t *in )
void expand_tilde( wcstring &input)
{
if( input[0] == L'~' )
if( ! input.empty() && input.at(0) == L'~' )
{
input[0] = HOME_DIRECTORY;
input.at(0) = HOME_DIRECTORY;
expand_tilde_internal( input );
}
}
wchar_t * expand_tilde_compat( wchar_t *input )
{
if (input[0] == L'~') {
input[0] = HOME_DIRECTORY;
return expand_tilde_internal_compat(input);
}
return input;
}
/**
Remove any internal separators. Also optionally convert wildcard characters to
regular equivalents. This is done to support EXPAND_SKIP_WILDCARDS.