akofman / cordova-plugin-add-swift-support

:hammer: Swiftify your Cordova app !
MIT License
117 stars 110 forks source link

Fix the issue with irregular platform version #35

Closed knight9999 closed 7 years ago

knight9999 commented 7 years ago

iOSPlatform version should be the semver form, like "4.4.0". However, If the user add platform ios by using the directory name or git:// case, like

cordova platform add /Home/user/cordova/ios/cordova-ios4.4.0

The iOSPlatform version is Home/user/cordova/ios/cordova-ios4.4.0 not 4.4.0. (See https://github.com/apache/cordova-lib/blob/master/src/cordova/platform_metadata.js and its comment above the getVersions method)

In such case, this plugin hook script does not work.

This pull request, the correct iOSPlatform version is obtained by accessing platform/ios/cordova/version file.

akofman commented 7 years ago

Hello,

Thanks for pointing this issue. I didn't test it but maybe you could use the getPlatVersionsFromFileSystem function instead of getVersions in order to avoid the use of __non_webpack_require__ which is really Webpack specific. What do you think ?

knight9999 commented 7 years ago

Thanks you. As you say, getPlatVersionsFromFile is more suitable. Now I will try to send pull request again.

knight9999 commented 7 years ago

I send new Pull Request https://github.com/akofman/cordova-plugin-add-swift-support/pull/36 .