Extract the dirname from the file path.
file path to be checked.
string of dirname. If path is null or not file path, return "";