Issue #3129508 by Lal_, daffie, Suresh Prabhu Parkala: Change multiple dirname()'s into a single dirname() with the use of the second parameter of dirname() (cherry picked from commit 8f7f02c6)