I'm creating a .tar.xz archive like this:
XZ_DEFAULTS="T$(nproc)" tar cvfJ "$archive" -C "$dir" .
It's creating this useless . directory when I try to open the archive:

How can I fix that?
This seems to work:
(shopt -s dotglob && cd "$dir" && XZ_DEFAULTS="--threads=0" tar cvfJ "$archive" *)
(Improved with Freddy's suggestion)
It's a little annoying because $archive has to be an absolute path or relative to $dir now and , but I can work around that at least.* doesn't generally include dot files
dotglob if you use bash and want to include hidden files: (shopt -s dotglob; cd "$dir"; XZ_DEFAULTS="T$(nproc)" tar cvfJ "$archive" *)