Fixed path not detected properly when prefix are missing from pattern

Signed-off-by: crynobone <crynobone@gmail.com>