const project = require('../../project')

const {exec} = require('../../utils/shell')
/**
 * Android gradle权限申请
 */
const gradleAccessRequest = async (requestPath) => {
    // var fs = require("fs");
    // fs.chmod(requestPath, 777, function (err) {
    //     if (err) console.warn(`${requestPath} 文件提权失败，请手动提权运行chmod 755 ${requestPath}`);
    // });

    try {
        await exec(`chmod +x ${requestPath}`, {silent: false})
        console.ok('Android gradlew 权限获取成功')
    } catch (e) {
        console.fail(`Android gradlew权限获取失败，请手动运行 chmod +x ${requestPath}`);
        console.fatal(e.message)
    }
};


module.exports = {gradleAccessRequest};
