dirname modifies the string.