zola icon indicating copy to clipboard operation
zola copied to clipboard

Refactor: remove even more unnecessary create_directory

Open clarfonthey opened this issue 6 months ago • 1 comments

  • [x] Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • [x] Are you doing the PR on the next branch?

These are some things that were missed even by #2407.

After doing some more investigation, even copying files will automatically create directories, so, we don't need these calls either. It simplifies the code a bit more and will also ensure that directories aren't created unless files are actually inside them.

Another reason for this change is it also makes calls to write_content and write_section a bit less confusing, since right now, if multiple calls to it are made, the final argument is set to false to avoid doing work, which can make following the code a bit more challenging since it's not always clear when this argument is applied.

clarfonthey avatar Jan 28 '24 00:01 clarfonthey

Looks like legit CI failures?

Keats avatar Jan 28 '24 23:01 Keats

They were, and sorry for taking so long to get back to this. Essentially, I thought that since these directories were always being made for copied files, they were also made for created files, which was not the case. I decided to go ahead and update things so that this is the case, but I understand if you'd rather not merge this PR because of that. While I personally think it makes the code simpler, that's not really an objective thing, just my opinion.

clarfonthey avatar Feb 27 '24 23:02 clarfonthey