Check and Create folders

● ARCHIVED · READ-ONLY
Started by Deleted member 113412 4 posts View original ↗
  1. Hello. I wanted to see if there was a possibility to make a plugin that would check for specific folders on startup and if they don't exist, to create them.

    Think of this as a custom folder checker for your game. It would check for folders that you specify and if it doesn't exist, would create them before loading ANYTHING.

    What I am hoping for, is a way to reduce simple dev errors when deploying without these folders.

    Thanks!
  2. .. no need plugin for this.

    PHP:
    var path = require('path'),
        fs = require('fs');
    
    function ensureDirectoryExistence(filePath) {
      var dirname = path.dirname(filePath);
      if (fs.existsSync(dirname)) {
        return true;
      }
      ensureDirectoryExistence(dirname);
      fs.mkdirSync(dirname);
    }

    work only for pc distribution with app.
    Not work on web client or android for security reason.
  3. Jonforum said:
    .. no need plugin for this.

    PHP:
    var path = require('path'),
        fs = require('fs');
    
    function ensureDirectoryExistence(filePath) {
      var dirname = path.dirname(filePath);
      if (fs.existsSync(dirname)) {
        return true;
      }
      ensureDirectoryExistence(dirname);
      fs.mkdirSync(dirname);
    }

    work only for pc distribution with app.
    Not work on web client or android for security reason.

    What do i do with this?
    Where do i add it?
  4. Bumping...