@@ -144,22 +144,6 @@ export class PlatformController implements IPlatformController {
144
144
path . join ( projectData . platformsDir , platformName )
145
145
) ;
146
146
147
- if ( hasPlatformDirectory ) {
148
- const platformDirectoryItemCount = this . $fs . readDirectory (
149
- path . join ( projectData . platformsDir , platformName )
150
- ) . length ;
151
-
152
- // 5 is a magic number to approximate a valid platform folder
153
- // any valid platform should contain at least 5 files
154
- // we choose 5 to avoid false-positives due to system files like .DS_Store etc.
155
- if ( platformDirectoryItemCount <= 5 ) {
156
- this . $logger . warn (
157
- `The platforms/${ platformName } folder appears to be invalid. If the build fails, run 'ns clean' and rebuild the app.` ,
158
- { wrapMessageWithBorders : true }
159
- ) ;
160
- }
161
- }
162
-
163
147
const shouldAddNativePlatform =
164
148
! nativePrepare || ! nativePrepare . skipNativePrepare ;
165
149
const prepareInfo = this . $projectChangesService . getPrepareInfo (
@@ -169,11 +153,27 @@ export class PlatformController implements IPlatformController {
169
153
prepareInfo &&
170
154
prepareInfo . nativePlatformStatus ===
171
155
NativePlatformStatus . requiresPlatformAdd ;
172
- const result =
156
+ const shouldAddPlatform =
173
157
! hasPlatformDirectory ||
174
158
( shouldAddNativePlatform && requiresNativePlatformAdd ) ;
175
159
176
- return ! ! result ;
160
+ if ( hasPlatformDirectory && ! shouldAddPlatform ) {
161
+ const platformDirectoryItemCount = this . $fs . readDirectory (
162
+ path . join ( projectData . platformsDir , platformName )
163
+ ) . length ;
164
+
165
+ // 3 is a magic number to approximate a valid platform folder
166
+ // any valid platform should contain at least 3 files
167
+ // we choose 3 to avoid false-positives due to system files like .DS_Store etc.
168
+ if ( platformDirectoryItemCount <= 3 ) {
169
+ this . $logger . warn (
170
+ `The platforms/${ platformName } folder appears to be invalid. If the build fails, run 'ns clean' and rebuild the app.` ,
171
+ { wrapMessageWithBorders : true }
172
+ ) ;
173
+ }
174
+ }
175
+
176
+ return ! ! shouldAddPlatform ;
177
177
}
178
178
}
179
179
injector . register ( "platformController" , PlatformController ) ;
0 commit comments