code: function _checkPathX(relfolder, skipCreation) {
    if (!relfolder) return;
    const parts = relfolder.split(path.sep);
    var checked = _state.root;
    var checkedParts = '';
    var index = 0;
    var skip =  false;
    do {
      checked = path.join(checked, parts[index]);
      if (!fs.existsSync(checked)) {
        if (!skipCreation) {
          fs.mkdirSync(checked);
          checkedParts = path.join(checkedParts, parts[index]);
        } else {
          skip = true;
        }
      } else {
        checkedParts = path.join(checkedParts, parts[index]);
      }
      index++;
    } while (!skip && index < parts.length);
    return checkedParts;
  }
docs: check the path