This function strips the final file or directory name from the path to produce its parent. Any trailing directory separators are also removed. If the path represents the root of the file system then it is unmodified.
Gamma> x = "/usr/doc/FAQ";
"/usr/doc/FAQ"
Gamma> x = root_path(x);
"/usr/doc"
Gamma> x = root_path(x);
"/usr"
Gamma> x = root_path(x);
"/"
Gamma> x = root_path(x);
"/"
Gamma>