MCPcopy
hub / github.com/ionic-team/capacitor / determineIOSWebDirAbs

Function determineIOSWebDirAbs

cli/src/config.ts:339–366  ·  view source on GitHub ↗
(
  nativeProjectDirAbs: string,
  nativeTargetDirAbs: string,
  nativeXcodeProjDirAbs: string,
)

Source from the content-addressed store, hash-verified

337}
338
339async function determineIOSWebDirAbs(
340 nativeProjectDirAbs: string,
341 nativeTargetDirAbs: string,
342 nativeXcodeProjDirAbs: string,
343): Promise<string> {
344 const re = /path\s=\spublic[\s\S]+?sourceTree\s=\s([^;]+)/;
345 const pbxprojPath = resolve(nativeXcodeProjDirAbs, 'project.pbxproj');
346 try {
347 const pbxproj = await readFile(pbxprojPath, { encoding: 'utf8' });
348
349 const m = pbxproj.match(re);
350
351 if (m && m[1] === 'SOURCE_ROOT') {
352 logger.warn(
353 `Using the iOS project root for the ${c.strong('public')} directory is deprecated.\n` +
354 `Please follow the Upgrade Guide to move ${c.strong('public')} inside the iOS target directory: ${c.strong(
355 'https://capacitorjs.com/docs/updating/3-0#move-public-into-the-ios-target-directory',
356 )}`,
357 );
358
359 return resolve(nativeProjectDirAbs, 'public');
360 }
361 } catch (e) {
362 // ignore
363 }
364
365 return resolve(nativeTargetDirAbs, 'public');
366}
367
368async function determineAndroidStudioPath(os: OS): Promise<string> {
369 if (process.env.CAPACITOR_ANDROID_STUDIO_PATH) {

Callers 1

loadIOSConfigFunction · 0.85

Calls 3

readFileFunction · 0.85
matchMethod · 0.80
warnMethod · 0.80

Tested by

no test coverage detected