Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cordova): handle source-file with framework attribute #2507

Merged
merged 1 commit into from
Mar 2, 2020

Conversation

jcesarmobile
Copy link
Member

don't try to read source-file tags with framework attribute as they might be directories

closes #2506

@jcesarmobile jcesarmobile merged commit f7cd4c0 into ionic-team:master Mar 2, 2020
@jcesarmobile jcesarmobile deleted the source-file-framework branch March 2, 2020 17:27
mion00 pushed a commit to mion00/capacitor that referenced this pull request Mar 25, 2020
@rfeague
Copy link

rfeague commented Apr 29, 2020

Unfortunately the fix above doesn't work when providers of plugins sometimes use to indicate what is actually a folder, but is not part of a framework. Example: https://cmbdn.cognex.com/files/download_latest/cmbSDK_Cordova
has this line in plugin.xml:

but ic_blank.imageset is actually a directory. As a result, npx cap sync (among other commands) fails at
@capacitor/cli/dist/ios/update.js:282:40
on the file
ios/capacitor-cordova-ios-plugins/sources/CmbsdkCordova/ic_blank.imageset
which has $ values:
{
src: 'src/ios/CMBScanner/SDK/cmbsdk-ios-binary/Resources/MWBScannerImages.xcassets/ic_blank.imageset',
'target-dir': '../../Images.xcassets'
}
Note that this passes the added conditional test: if (!codeFile.$.framework) {
Resulting in this error:
✖ update ios: EISDIR: illegal operation on a directory, read
[error] Error running update: Error: EISDIR: illegal operation on a directory, read
at Object.readSync (fs.js:577:3)
at tryReadSync (fs.js:353:20)
at Object.readFileSync (fs.js:390:19)
at /Users/roy.feague/proj/cmta-app/node_modules/@capacitor/cli/dist/ios/update.js:282:40
at Array.map ()
at /Users/roy.feague/proj/cmta-app/node_modules/@capacitor/cli/dist/ios/update.js:266:19
at Array.map ()
at copyPluginsNativeFiles (/Users/roy.feague/proj/cmta-app/node_modules/@capacitor/cli/dist/ios/update.js:254:20)
at Object.updateIOS (/Users/roy.feague/proj/cmta-app/node_modules/@capacitor/cli/dist/ios/update.js:27:9)
at async /Users/roy.feague/proj/cmta-app/node_modules/@capacitor/cli/dist/tasks/update.js:53:17 {
errno: -21,
syscall: 'read',
code: 'EISDIR'
}
In light of the fact that some providers are using source-file for directories, maybe we could just try/catch this read or explicitly verify that the object is a file and not a directory?

@jcesarmobile
Copy link
Member Author

Can you report it as an issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

InfinitePeripherals Cordova package
2 participants