Add folder with dot in name in file expansion test

Tests fail because a dot is encountered before reaching the file when
specifying the 'ext' option.
Fix extension replacement using path methods