Properly localize absolute path.
Calling localize_path will return a localized path in res:// if the
path starts with the resource file-system/folder, and will return
the unchanged absolute path otherwise.
Closes #6979 and #7161.
(cherry picked from commit cdc97ca4535e99fdcb10f21c4609c2f79e94589b)