filelogger icon indicating copy to clipboard operation
filelogger copied to clipboard

proposal: add option to change cordova.file.dataDirectory to cordova.file.externalDataDirectory

Open hreimer opened this issue 7 years ago • 2 comments

Hi, upon testing your plugin I found that if a internal webserver is used*, the log file is stored under cdvfile://localhost/files/.txt, which (in my case) is inaccessible although it gets written, it's just useless for further debugging if it only persists in an inaccessible location during runtime.

I found in your sourcecode, if I changed all appearances of cordova.file.dataDirectory to cordova.file.externalDataDirectory the file gets created and I can find it under /Android/data//files/.txt. For now I will fork your plugin, however I thought maybe others faced the same issues and a fileDirectory option would be a nice addition.

*see these plugins: cocoon-cordova-labs-local-webserver, cocoon-cordova-labs-wkwebview-engine-localhost, cocoon-cordova-plugin-wkwebview-engine

Using Ionic 1.3.3 & cordova 6.5.0, my device is a Samsung Galaxy J3 2016

hreimer avatar Dec 19 '17 23:12 hreimer

+1

robindierckx avatar Sep 25 '18 09:09 robindierckx

We can't change everything to cordova.file.externalDataDirectory as that breaks iOS. cordova.file.dataDirectory is correct and works on both Android and iOS.

When you do $filelogger.checkFile() it returns a name. All you need to do is:

var myFileWithPath = cordova.file.dataDirectory + result.name // result is the return object from checkFile

And you'll get the full path with file. Verified with wkwebview and iOS and Android. Sample code.

pliablepixels avatar Oct 27 '18 14:10 pliablepixels