<commit_before>'use strict';
const fs = require('fs-extra');
const constants = require('constants');

const errors = require('../../../errors');
const checkDirectoryAndAbove = require('./check-directory');

const taskTitle = 'Checking current folder permissions';

function installFolderPermissions(ctx) {
    return fs.access(process.cwd(), constants.R_OK | constants.W_OK).catch(() => {
        return Promise.reject(new errors.SystemError({
            message: `The current directory is not writable.
Please fix your directory permissions.`,
            task: taskTitle
        }));
    }).then(() => {
        if (ctx.local || !ctx.system.platform.linux || (ctx.argv && ctx.argv['setup-linux-user'] === false)) {
            return Promise.resolve();
        }

        return checkDirectoryAndAbove(process.cwd(), 'run `ghost install`', taskTitle);
    });
}

module.exports = {
    title: taskTitle,
    task: installFolderPermissions,
    category: ['install', 'update']
};<commit_msg>fix(doctor): add install-folder-permissions check to start<commit_after>'use strict';
const fs = require('fs-extra');
const constants = require('constants');

const errors = require('../../../errors');
const checkDirectoryAndAbove = require('./check-directory');

const taskTitle = 'Checking current folder permissions';

function installFolderPermissions(ctx) {
    return fs.access(process.cwd(), constants.R_OK | constants.W_OK).catch(() => {
        return Promise.reject(new errors.SystemError({
            message: `The current directory is not writable.
Please fix your directory permissions.`,
            task: taskTitle
        }));
    }).then(() => {
        if (ctx.local || !ctx.system.platform.linux || (ctx.argv && ctx.argv['setup-linux-user'] === false)) {
            return Promise.resolve();
        }

        return checkDirectoryAndAbove(process.cwd(), 'run `ghost install`', taskTitle);
    });
}

module.exports = {
    title: taskTitle,
    task: installFolderPermissions,
    category: ['install', 'update', 'start']
};
{'fraction_non_alphanumeric': 0.15784313725490196, 'fraction_numerical': 0.0, 'mean_word_length': 3.408207343412527, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7388367', 'n_tokens_mistral': 550, 'n_tokens_neox': 550, 'n_words': 138}