created sub function :convertArrayToPath