Skip to content
This repository has been archived by the owner on Jan 18, 2024. It is now read-only.

Commit

Permalink
fix iOS name changing (#2497)
Browse files Browse the repository at this point in the history
  • Loading branch information
EvanBacon committed Aug 25, 2020
1 parent 10a4d1d commit 6edede3
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions packages/expo-cli/src/commands/apply/configureIOSProjectAsync.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { IOSConfig, WarningAggregator, getConfig } from '@expo/config';
import { getProjectName } from '@expo/config/build/ios/utils/Xcodeproj';
import { IosPlist, UserManager } from '@expo/xdl';
import path from 'path';

Expand Down Expand Up @@ -106,14 +107,23 @@ function sanitizedName(name: string) {
// placeholder for now! Make this more robust when we support applying config
// at any time (currently it's only applied on eject).
function getIOSPaths(projectRoot: string) {
const { exp } = getConfig(projectRoot, { skipSDKVersionRequirement: true });
let projectName: string | null = null;

const projectName = exp.name;
if (!projectName) {
throw new Error('Your project needs a name in app.json/app.config.js.');
// Attempt to get the current ios folder name (apply).
try {
projectName = getProjectName(projectRoot);
} catch {
// If no iOS project exists then create a new one (eject).
const { exp } = getConfig(projectRoot, { skipSDKVersionRequirement: true });

projectName = exp.name;
if (!projectName) {
throw new Error('Your project needs a name in app.json/app.config.js.');
}
projectName = sanitizedName(projectName);
}

const iosProjectDirectory = path.join(projectRoot, 'ios', sanitizedName(projectName));
const iosProjectDirectory = path.join(projectRoot, 'ios', projectName);
const iconPath = path.join(iosProjectDirectory, 'Assets.xcassets', 'AppIcon.appiconset');

return {
Expand Down

0 comments on commit 6edede3

Please sign in to comment.