function updatePathInternal()

in src/FileUpdater.js [116:133]


function updatePathInternal (sourcePath, targetPath, options, log) {
    const rootDir = (options && options.rootDir) || '';
    const targetFullPath = path.join(rootDir, targetPath);
    const targetStats = fs.existsSync(targetFullPath) ? fs.statSync(targetFullPath) : null;
    let sourceStats = null;

    if (sourcePath) {
        // A non-null source path was specified. It should exist.
        const sourceFullPath = path.join(rootDir, sourcePath);
        if (!fs.existsSync(sourceFullPath)) {
            throw new Error(`Source path does not exist: ${sourcePath}`);
        }

        sourceStats = fs.statSync(sourceFullPath);
    }

    return updatePathWithStats(sourcePath, sourceStats, targetPath, targetStats, options, log);
}