When generating a local path, if the folder doesn't exist the function
attempts to create a valid new path.
Added javadoc.
Added and corrected javadoc.
Added a few more checks in case of receiving null values.