Remove usage of deprecated function

Remove usage of deprecated function setPattern() and replace with replacement function setPath().