Haneke / HanekeSwift

A lightweight generic cache for iOS written in Swift with extra love for images.
Apache License 2.0
5.21k stars 591 forks source link

Create intermediate directories before writing to a file #451

Open JustusvonBrandt opened 5 years ago

JustusvonBrandt commented 5 years ago

This pull request makes sure, that before a file is written to the disk, the folders in the path it should be written to exists. All the needed intermediate directories are created, so that the data can be written to the file without failing due to a non existing directory.

Some already mentioned in #371 and #245, that after the removeAll() method of a cache is called, the folders are deleted, but not recreated directly. So the writes after calling removeAll() are failing with an error.