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

Troubleshooting ios build error #479

Draft
wants to merge 12 commits into
base: master
Choose a base branch
from
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ jobs:

- uses: codecov/codecov-action@v1
with:
fail_ci_if_error: true
fail_ci_if_error: false
6 changes: 4 additions & 2 deletions tests/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -3832,16 +3832,18 @@ exports.defineAutoTests = function () {
expect(entry.name).toCanonicallyMatch('logo.png');
expect(entry.fullPath).toCanonicallyMatch('/www/img/logo.png');
expect(entry.filesystem.name).toEqual(cdvfileApplicationDirectoryFsRootName);

var internalURL = entry.toInternalURL();
expect(internalURL).toEqual('wrong', 'It should be an internalUrl what is it?' + internalURL);
var img = new Image(); // eslint-disable-line no-undef
img.onerror = function (err) {
console.error('Current error', err);
expect(err).not.toBeDefined();
done();
};
img.onload = function () {
done();
};
img.src = entry.toInternalURL();
img.src = internalURL;
}, failed.bind(null, done, 'resolveLocalFileSystemURL failed for cdvfile applicationDirectory'));
}, failed.bind(null, done, 'resolveLocalFileSystemURL failed for cdvfile applicationDirectory'));
});
Expand Down
13 changes: 11 additions & 2 deletions www/ios/FileSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,17 @@
FILESYSTEM_PROTOCOL = 'cdvfile';

module.exports = {
__format__: function (fullPath) {
__format__: function (fullPath, internalUrl) {
console.error('__format__', fullPath, internalUrl);
var path = ('/' + this.name + (fullPath[0] === '/' ? '' : '/') + FileSystem.encodeURIPath(fullPath)).replace('//', '/');
return FILESYSTEM_PROTOCOL + '://localhost' + path;
var cdvFilePath = FILESYSTEM_PROTOCOL + '://localhost' + path;

if (cdvFilePath && window && window.WkWebView) { // https://github.com/apache/cordova-plugin-file/pull/457/commits/fea030f4e870ad7a2f07a8063c7da894ee9b2818
var convertedFilePath = window.WkWebView.convertFilePath(cdvFilePath);
console.error('convertedFilePath', cdvFilePath, convertedFilePath);
return convertedFilePath;
}

return cdvFilePath;
}
};