Skip to content

Commit

Permalink
Merge pull request #39 from itskreisler/master
Browse files Browse the repository at this point in the history
Validates if the directory does not exist and creates it
  • Loading branch information
donjajo authored May 16, 2022
2 parents 45a6749 + 313b09d commit e19b80f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/JSONDB.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ private function check_file()
* @return bool
*/

// Checks if DIR exists, if not create
if (! is_dir($this->dir)) {
mkdir($this->dir, 0700);
}
// Checks if JSON file exists, if not create
if (! file_exists($this->file)) {
touch($this->file);
Expand Down

0 comments on commit e19b80f

Please sign in to comment.