(fixes #2173, BP from #1675) use dirname() only if the path contains script name
(fixes #2173, BP from #1675) use dirname() only if the path contains script name

tejima/testravis,tejima/testravis,tejima/testravis