How to use the cordova-common.FileUpdater.updatePaths function in cordova-common

To help you get started, we’ve selected a few cordova-common examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Adobe-Marketing-Cloud-Apps / app-sample-android-phonegap / platforms / android / cordova / lib / prepare.js View on Github external
function cleanIcons(projectRoot, projectConfig, platformResourcesDir) {
    var icons = projectConfig.getIcons('android');
    if (icons.length > 0) {
        var resourceMap = mapImageResources(projectRoot, platformResourcesDir, 'mipmap', 'icon.png');
        events.emit('verbose', 'Cleaning icons at ' + platformResourcesDir);

        // No source paths are specified in the map, so updatePaths() will delete the target files.
        FileUpdater.updatePaths(
            resourceMap, { rootDir: projectRoot, all: true }, logFileOp);
    }
}
github weexteam / pack-android-tools-for-Apache-Weex / bin / templates / cordova / lib / prepare.js View on Github external
function cleanIcons(projectRoot, projectConfig, platformResourcesDir) {
    var icons = projectConfig.getIcons('android');
    if (icons.length > 0) {
        var resourceMap = mapImageResources(projectRoot, platformResourcesDir, 'mipmap', 'icon.png');
        events.emit('verbose', 'Cleaning icons at ' + platformResourcesDir);

        // No source paths are specified in the map, so updatePaths() will delete the target files.
        FileUpdater.updatePaths(
            resourceMap, { rootDir: projectRoot, all: true }, logFileOp);
    }
}
github katzer / cordova-plugin-badge / platforms / windows / cordova / lib / prepare.js View on Github external
function cleanImages(projectRoot, projectConfig, locations) {
    var images = projectConfig.getIcons('windows')
        .concat(projectConfig.getSplashScreens('windows'));

    if (images.length > 0) {
        var imagesDir = path.join(path.relative(projectRoot, locations.root), 'images');
        var resourceMap = mapImageResources(images, imagesDir);
        Object.keys(resourceMap).forEach(function (targetImagePath) {
            resourceMap[targetImagePath] = null;
        });
        events.emit('verbose', 'Cleaning icons and splash screens at ' + imagesDir);

        // Source paths are removed from the map, so updatePaths() will delete the target files.
        FileUpdater.updatePaths(
            resourceMap, { rootDir: projectRoot, all: true }, logFileOp);
    }
}
github katzer / cordova-plugin-background-mode / platforms / ios / cordova / lib / prepare.js View on Github external
function cleanSplashScreens(projectRoot, projectConfig, locations) {
    var splashScreens = projectConfig.getSplashScreens('ios');
    if (splashScreens.length > 0) {
        var platformProjDir = path.relative(projectRoot, locations.xcodeCordovaProj);
        var splashScreensDir = getSplashScreensDir(projectRoot, platformProjDir);
        var resourceMap = mapIconResources(splashScreens, splashScreensDir);
        Object.keys(resourceMap).forEach(function (targetSplashPath) {
            resourceMap[targetSplashPath] = null;
        });
        events.emit('verbose', 'Cleaning splash screens at ' + splashScreensDir);

        // Source paths are removed from the map, so updatePaths() will delete the target files.
        FileUpdater.updatePaths(
            resourceMap, { rootDir: projectRoot, all: true }, logFileOp);
    }
}
github QuickBlox / quickblox-javascript-sdk / samples / cordova / video_chat / platforms / android / cordova / lib / prepare.js View on Github external
// project's config.xml location, so we use it as base path.
    for (var density in android_icons) {
        var targetPath = getImageResourcePath(
            platformResourcesDir, 'mipmap', density, 'icon.png', path.basename(android_icons[density].src));
        resourceMap[targetPath] = android_icons[density].src;
    }

    // There's no "default" drawable, so assume default == mdpi.
    if (default_icon && !android_icons.mdpi) {
        var defaultTargetPath = getImageResourcePath(
            platformResourcesDir, 'mipmap', 'mdpi', 'icon.png', path.basename(default_icon.src));
        resourceMap[defaultTargetPath] = default_icon.src;
    }

    events.emit('verbose', 'Updating icons at ' + platformResourcesDir);
    FileUpdater.updatePaths(
        resourceMap, { rootDir: cordovaProject.root }, logFileOp);
}
github intel-iot-devkit / android-things-samples / Zombie / ZombieDetector / platforms / android / cordova / lib / prepare.js View on Github external
// project's config.xml location, so we use it as base path.
    for (var density in android_icons) {
        var targetPath = getImageResourcePath(
            platformResourcesDir, 'mipmap', density, 'icon.png', path.basename(android_icons[density].src));
        resourceMap[targetPath] = android_icons[density].src;
    }

    // There's no "default" drawable, so assume default == mdpi.
    if (default_icon && !android_icons.mdpi) {
        var defaultTargetPath = getImageResourcePath(
            platformResourcesDir, 'mipmap', 'mdpi', 'icon.png', path.basename(default_icon.src));
        resourceMap[defaultTargetPath] = default_icon.src;
    }

    events.emit('verbose', 'Updating icons at ' + platformResourcesDir);
    FileUpdater.updatePaths(
        resourceMap, { rootDir: cordovaProject.root }, logFileOp);
}
github heyszu / szuschedule-app / platforms / android / cordova / lib / prepare.js View on Github external
// project's config.xml location, so we use it as base path.
    for (var density in android_icons) {
        var targetPath = getImageResourcePath(
            platformResourcesDir, 'mipmap', density, 'icon.png', path.basename(android_icons[density].src));
        resourceMap[targetPath] = android_icons[density].src;
    }

    // There's no "default" drawable, so assume default == mdpi.
    if (default_icon && !android_icons.mdpi) {
        var defaultTargetPath = getImageResourcePath(
            platformResourcesDir, 'mipmap', 'mdpi', 'icon.png', path.basename(default_icon.src));
        resourceMap[defaultTargetPath] = default_icon.src;
    }

    events.emit('verbose', 'Updating icons at ' + platformResourcesDir);
    FileUpdater.updatePaths(
        resourceMap, { rootDir: cordovaProject.root }, logFileOp);
}
github aayusharora / Aftershoot / poc / Cordova / platforms / android / cordova / lib / prepare.js View on Github external
function cleanFileResources (projectRoot, projectConfig, platformDir) {
    var files = projectConfig.getFileResources('android', true);
    if (files.length > 0) {
        events.emit('verbose', 'Cleaning resource files at ' + platformDir);

        var resourceMap = {};
        files.forEach(function (res) {
            var filePath = path.join(platformDir, res.target);
            resourceMap[filePath] = null;
        });

        FileUpdater.updatePaths(
            resourceMap, {
                rootDir: projectRoot, all: true }, logFileOp);
    }
}
github apache / cordova-android / bin / templates / cordova / lib / prepare.js View on Github external
function cleanFileResources (projectRoot, projectConfig, platformDir) {
    var files = projectConfig.getFileResources('android', true);
    if (files.length > 0) {
        events.emit('verbose', 'Cleaning resource files at ' + platformDir);

        var resourceMap = {};
        files.forEach(function (res) {
            var filePath = path.join(platformDir, res.target);
            resourceMap[filePath] = null;
        });

        FileUpdater.updatePaths(
            resourceMap, {
                rootDir: projectRoot, all: true }, logFileOp);
    }
}
github katzer / cordova-plugin-local-notifications / platforms / ios / cordova / lib / prepare.js View on Github external
let src = res.src,
                target = res.target;

            if (!target) {
                target = src;
            }

            let targetPath = path.join(project.resources_dir, target);
            targetPath = path.relative(projectRoot, targetPath);
            const resfile = path.join('Resources', path.basename(targetPath));
            project.xcode.removeResourceFile(resfile);

            resourceMap[targetPath] = null;
        });

        FileUpdater.updatePaths(
                resourceMap, { rootDir: projectRoot, all: true}, logFileOp);

        project.write();
    }
}