@@ -169,14 +169,18 @@ export class ProjectData implements IProjectData {
169169 nsConfig && nsConfig . projectName
170170 ? nsConfig . projectName
171171 : this . $projectHelper . sanitizeName ( path . basename ( projectDir ) ) ;
172- this . platformsDir = path . join ( projectDir , constants . PLATFORMS_DIR_NAME ) ;
172+ // read before `platformsDir`, which is derived from it
173+ this . nsConfig = nsConfig ;
174+ this . platformsDir = path . join (
175+ projectDir ,
176+ this . getBuildRelativeDirectoryPath ( ) ,
177+ ) ;
173178 this . projectFilePath = projectFilePath ;
174179 this . projectIdentifiers = this . initializeProjectIdentifiers ( nsConfig ) ;
175180 this . packageJsonData = packageJsonData ;
176181 this . dependencies = packageJsonData . dependencies ;
177182 this . devDependencies = packageJsonData . devDependencies ;
178183 this . projectType = this . getProjectType ( ) ;
179- this . nsConfig = nsConfig ;
180184 this . ignoredDependencies = nsConfig ?. ignoredNativeDependencies ;
181185 this . appDirectoryPath = this . getAppDirectoryPath ( ) ;
182186 this . appResourcesDirectoryPath = this . getAppResourcesDirectoryPath ( ) ;
@@ -276,6 +280,18 @@ export class ProjectData implements IProjectData {
276280 // );
277281 }
278282
283+ /**
284+ * Where the native projects are generated, relative to the project root.
285+ * `buildPath` in the project config overrides the default `platforms`.
286+ */
287+ public getBuildRelativeDirectoryPath ( ) : string {
288+ if ( this . nsConfig && this . nsConfig [ constants . CONFIG_NS_BUILD_ENTRY ] ) {
289+ return this . nsConfig [ constants . CONFIG_NS_BUILD_ENTRY ] ;
290+ }
291+
292+ return constants . PLATFORMS_DIR_NAME ;
293+ }
294+
279295 public getAppDirectoryPath ( projectDir ?: string ) : string {
280296 const appRelativePath = this . getAppDirectoryRelativePath ( ) ;
281297
0 commit comments