How to use the @ionic/utils-fs.pathWritable function in @ionic/utils-fs

To help you get started, we’ve selected a few @ionic/utils-fs 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 ionic-team / ionic-cli / packages / ionic / src / commands / deploy / core.ts View on Github external
protected async getAndroidCapString(): Promise {
    if (!this.project) {
      return '';
    }
    const capIntegration = this.project.getIntegration('capacitor');
    if (!capIntegration) {
      return '';
    }
    // check first if iOS exists
    if (!await pathExists(path.join(capIntegration.root, 'android'))) {
      return '';
    }
    const assumedStringXmlPath = path.join(capIntegration.root, 'android', 'app', 'src', 'main', 'res', 'values', 'strings.xml');
    if (!await pathWritable(assumedStringXmlPath)) {
      throw new Error('The Android string.xml could not be found.');
    }
    return assumedStringXmlPath;
  }
github ionic-team / ionic-cli / packages / ionic / src / commands / deploy / core.ts View on Github external
protected async getIosCapPlist(): Promise {
    if (!this.project) {
      return '';
    }
    const capIntegration = this.project.getIntegration('capacitor');
    if (!capIntegration) {
      return '';
    }
    // check first if iOS exists
    if (!await pathExists(path.join(capIntegration.root, 'ios'))) {
      return '';
    }
    const assumedPlistPath = path.join(capIntegration.root, 'ios', 'App', 'App', 'Info.plist');
    if (!await pathWritable(assumedPlistPath)) {
      throw new Error('The iOS Info.plist could not be found.');
    }
    return assumedPlistPath;
  }
github ionic-team / cordova-res / src / index.ts View on Github external
errstream = process.stderr,
  platforms = {
    [Platform.ANDROID]: generateRunOptions(Platform.ANDROID, resourcesDirectory, []),
    [Platform.IOS]: generateRunOptions(Platform.IOS, resourcesDirectory, []),
    [Platform.WINDOWS]: generateRunOptions(Platform.WINDOWS, resourcesDirectory, []),
  },
}: CordovaRes.Options = {}): Promise {
  const configPath = getConfigPath(directory);

  debug('Paths: (config: %O) (resources dir: %O)', configPath, resourcesDirectory);

  let config: et.ElementTree | undefined;
  const resources: GeneratedResource[] = [];
  const sources: ResolvedSource[] = [];

  if (await pathWritable(configPath)) {
    config = await readConfig(configPath);
  } else {
    debug('File missing/not writable: %O', configPath);

    if (errstream) {
      errstream.write(`WARN: No config.xml file in directory. Skipping config.\n`);
    }
  }

  for (const platform of PLATFORMS) {
    const platformOptions = platforms[platform];

    if (platformOptions) {
      const platformResult = await runPlatform(platform, resourcesDirectory, platformOptions, errstream);
      logstream.write(`Generated ${platformResult.resources.length} resources for ${platform}\n`);
      resources.push(...platformResult.resources);