sda
Version:
Software development assistant
43 lines • 1.73 kB
JavaScript
;
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const fs = __importStar(require("fs"));
const path = __importStar(require("path"));
const Log_1 = __importDefault(require("../Log"));
const Constants_1 = require("./Constants");
/**
* Warn about old configuration files. Browses from the input folder path up to the root folder.
* @param dir - Directory to start browsing up
*/
function warnOldConfigFilePaths(dir) {
dir = path.normalize(dir);
let foundOldFiles = false;
const root = path.parse(dir).root;
do {
const fileName = path.join(dir, Constants_1.previousConfigFileName);
if (fs.existsSync(fileName)) {
if (!foundOldFiles) {
Log_1.default.log('');
Log_1.default.log('!!!!! WARNING !!!!!');
}
foundOldFiles = true;
Log_1.default.log(`Old config file found in "${fileName}". Please rename to "${Constants_1.configFileName}".`);
}
dir = path.normalize(path.join(dir, '..'));
} while (dir !== root);
if (foundOldFiles) {
Log_1.default.log('!!!!! WARNING !!!!!');
Log_1.default.log('');
}
}
exports.default = warnOldConfigFilePaths;
//# sourceMappingURL=warnOldConfigFilePaths.js.map