Making generateUniqueName() public so it can be used in other places aswell, and fixing a bug (missing path separator between directory and file name)