Open ZhennanWu opened 4 years ago
When doing that I had some errors later when I tried to retrieve the files with a "img.src=...".
I replaced the both tests by the following and it seems to work :
if (((cordova.platformId === 'browser') || (cordova.platformId === 'electron')) && require('./isChrome')()) { ... }
@ZhennanWu Thanks a lot, works for me!
cordova.platformId = 'electron' Linux x64, Debian 10
My app is running well on iOS, Android, Chrome browser.
It downloads images from a remote server and then uses them in a canvas.
1/ With
if (cordova.platformId === "browser" && require('./isChrome')()) {
in
FileProxy.js
requestFileSystem.js
requestFileSystem.js
$ rm -rf ~/.config/Electron
$ cordova run electron --nobuild
The download of images is OK. In my code I have :
img = new Image();
img.onload = imageLoaded;
img.src = filepaths.shift();
which results in :
GET file:///persistent//forms/form_200065_victime_0.png net::ERR_FILE_NOT_FOUND
2/ If I replace
if (cordova.platformId === "browser" && require('./isChrome')()) {
with
if (((cordova.platformId === "browser") || (cordova.platformId === "electron")) && require('./isChrome')()) {
in
FileProxy.js
requestFileSystem.js
requestFileSystem.js
(i.e use Chrome layer for manipulation of files in Electron)
Then
$ rm -rf ~/.config/Electron
$ cordova run electron --nobuild
Everything is working fine.
Hi,
I have an issue with this plugin on electron.
file:///www/res/languages/fr-FR.json cordova.js:1025 Error: exec proxy not found for :: File :: resolveLocalFileSystemURI objTraductions.js:75 FileSystem Error
I tried to include a json file with translations. It is running very well with android and iOS, but it does not work with electron.
I modified files as you mentionned but it is not running too.
Bug Report
Problem
What is expected to happen?
File APIs working normally and return a valid Entry or a valid error code.
What does actually happen?
When invoking any api, it will throw
with
Environment, Platform, Device
cordova.platformId = 'electron'
Linux x64, Ubuntu 18.04Checklist
Suspected Cause
Tracing the error output, I suspect this is caused by inconsistencies in platform detection strategy?
Eg: In src/browser/FileProxy.js and www/resolveLocalFileSystemURI.js
In src/browser/FileProxy.js, it assumes Electron have all the native APIs. So it choose to register nothing in the execProxy of Cordova. Meanwhile, other modules consider Electron not qualified (
cordova.platformId !== 'browser'
) and overrides its methods.Fixing Attempt
I've hacked src/browser/FileProxy.js to ensure it uses a consistent platform detection logic
And at least the API call is OK. No more
Error: exec proxy not found for :: File ::
Is there anyone who can confirm this issue? I'm not familiar with Cordova platform thus quite unsure about this fix.