cordova-plugin-shell-exec icon indicating copy to clipboard operation
cordova-plugin-shell-exec copied to clipboard

Read de external Storage sdcard

Open maxlinux2000 opened this issue 8 years ago • 2 comments

Hi

I'm tring to read (and then write) the sdcard using:

    <script>
    function lsfuncion() {
        window.ShellExec.exec('ls /sdcard/', function(res){
          console.log('exit status: ' + res.exitStatus)
          console.log('cmd output: ' + res.output)
//          alert(res.output)
            var div = document.getElementById("COMMAND");
            div.textContent = res.output;
            var text = div.textContent;
        })
    }    
    </script>
<div id="wrapper">
<p><a href="#" class="btn" onclick="lsfuncion();">$ ls /sdcard</a></p>
</div>  
<div id="COMMAND"></div>

but the result is: "Process has not yet termintated: 3577" ...that sound like the plugin can not read an external device mounted in the filesystem.

no problem if we try to read de root /

Can have a look for it, please?

maxlinux2000 avatar Apr 11 '16 22:04 maxlinux2000

honestly I have no idea how access rights are set on android on the /sdcard dir.

However from apk itself you definitely can read and write sdcard, at least I have experience doing it via cordova file plugin.

From this table it seems that <sdcard>/ dir is both r/w, but maybe <sdcard>/ dir is actually some subdir of your /sdcard/.

petervojtek avatar Apr 13 '16 06:04 petervojtek

You'd want to add the Android permission for storage and files: WRITE_EXTERNAL_STORAGE

gardner avatar May 31 '16 09:05 gardner