You need to convert the path to system path first. Here the exists
action of the fs
module with a little modification to use it in the extensions folder.
const fs = require('fs-extra');
const { toSystemPath } = require('../../lib/core/path');
exports.exists = async function(options) {
let path = toSystemPath(this.parseRequired(options.path, 'string', 'fs.exists: path is required.'));
if (fs.existsSync(path)) {
if (options.then) this.exec(options.then, true);
return true;
} else {
if (options.else) this.exec(options.else, true);
return false;
}
}