def _check_dir(self):
        """Makes sure that the working directory for the wrapper modules exists.
        """
        from os import path, mkdir
        if not path.isdir(self.dirpath):
            mkdir(self.dirpath)
            #Copy the ftypes.py module shipped with fortpy to the local directory.
            ftypes = path.join(get_fortpy_templates(), "ftypes.py")
            from shutil import copy
            copy(ftypes, self.dirpath)
            #Create the __init__.py file so that the library becomes a package for
            #its module contents.
            with open(path.join(self.dirpath, "__init__.py"), 'w') as f:
                f.write("# Auto-generated for package structure by fortpy.")

        #We also need to make sure that the fortpy deallocator module is present for
        #compilation in the shared library.
        if not path.isdir(self.f90path):
            mkdir(self.f90path)
            #Copy the ftypes.py module shipped with fortpy to the local directory.
            ftypes = path.join(get_fortpy_templates(), "ftypes_dealloc.f90")
            from shutil import copy
            copy(ftypes, self.f90path)
Makes sure that the working directory for the wrapper modules exists.