Skip to content

Commit ed7f95a

Browse files
Added check if sounds directory exists or not.
1 parent 6ca92c5 commit ed7f95a

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

app.config.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,20 @@ const withIOSSounds = (config) => {
1717
return withXcodeProject(config, async (cfg) => {
1818
const xcodeProject = cfg.modResults;
1919
const appName = 'CodeBuilder Admin'; // Match your iOS project name
20-
const soundFiles = fs.readdirSync(`./ios/${appName}/Sounds`);
20+
const iosFolderName = appName.replace(/\s+/g, '');
21+
const soundsDir = `./ios/${iosFolderName}/Sounds`;
22+
23+
// Check if directory exists before reading (handles prebuild --clean)
24+
if (!fs.existsSync(soundsDir)) {
25+
console.log(`⚠️ Sounds directory not found at ${soundsDir}, skipping sound file registration`);
26+
return cfg;
27+
}
28+
29+
const soundFiles = fs.readdirSync(soundsDir);
2130

2231
soundFiles.forEach((file) => {
2332
xcodeProject.addResourceFile({
24-
path: `${appName}/Sounds/${file}`,
33+
path: `${iosFolderName}/Sounds/${file}`,
2534
group: 'Resources',
2635
});
2736
});

0 commit comments

Comments
 (0)