react-native-asset
Version:
Linking and unlinking of assets in your react-native app, works for fonts and sounds
42 lines (41 loc) • 1.19 kB
JavaScript
import * as dntShim from "./_dnt.shims.js";
import * as path from "./deps/jsr.io/@std/path/1.1.4/mod.js";
export const getConfig = async ({ rootPath }) => {
const androidPath = path.resolve(rootPath, "android");
const iosPath = path.resolve(rootPath, "ios");
let androidExists = false;
let iosExists = false;
try {
const st = await dntShim.Deno.lstat(androidPath);
androidExists = st.isDirectory;
}
catch (_e) {
// Ok
}
let pbxprojPath = undefined;
try {
const st = await dntShim.Deno.lstat(iosPath);
iosExists = st.isDirectory;
for await (const dir of dntShim.Deno.readDir(iosPath)) {
if (dir.isDirectory && dir.name.endsWith(".xcodeproj")) {
const pbxproj = path.resolve(iosPath, dir.name, "project.pbxproj");
pbxprojPath = pbxproj;
break;
}
}
}
catch (_e) {
// Ok
}
return {
android: {
path: androidPath,
exists: androidExists,
},
ios: {
path: iosPath,
exists: iosExists,
pbxprojPath,
},
};
};