Trying a different solution. The existing solution only worked for relative paths in $DataDir. Now we check whether $DataDir starts with / or ./ and only prepend a ./ if it does not.
More changes required, finding more places where do or require is used.