apc-io / apc-firefox-os

Firefox OS on APC
94 stars 28 forks source link

Need app which can access USB flash or MicroSD card. #17

Open cmchen6585 opened 10 years ago

cmchen6585 commented 10 years ago

There is a app called Explorer which can access SD card, but the app can't install on APC FFOS.

ferndot commented 10 years ago

I am assuming that this app will be a file browser that uses deviceStorage and comes pre-installed. Is that correct?

moskovich commented 10 years ago

We hope so. Do you know of anything existing that works well?

Sean

On Fri, Aug 30, 2013 at 1:32 AM, Joshua Smith notifications@github.com wrote:

I am assuming that this app will be a file browser that uses deviceStorage, and come pre-installed. Is that correct?

Reply to this email directly or view it on GitHub: https://github.com/apc-io/apc-firefox-os/issues/17#issuecomment-23507461

ferndot commented 10 years ago

I was actually working on one for my startup @Codexa, let me commit the changes...

moskovich commented 10 years ago

Awesome!

Sean

On Fri, Aug 30, 2013 at 7:45 PM, Joshua Smith notifications@github.com wrote:

I was actually working on one for my startup @Codexa, let me commit the changes...

Reply to this email directly or view it on GitHub: https://github.com/apc-io/apc-firefox-os/issues/17#issuecomment-23555797

ferndot commented 10 years ago

Try https://github.com/Codexa/Prospector. It is bare bones right now (only displays files), but I am adding features.

moskovich commented 10 years ago

We'll have a build with this integrated next week. Probably towards the end of the week.

ntlc commented 10 years ago

Hi Joshua,

We're integrating this app into our build, however we're encountering this problem:

Latest commit of Prospector (Get Pictures storage) : works Ok on emulator but shows nothing on device. However, commit 26e59b7c64915680dbb141aca6137ce2a0119042 does show the content of SD Card on device.

Any idea? Tks.

ferndot commented 10 years ago

I know this sounds a little dumb, but could you please put alert(FILES); at the end of the io.enumerate() function, and tell me what it says, and what files are on your device?

I just need to know if the io code is messed up, or if it is a problem with display. I will test this myself as soon as I get my microSD to boot from.

ntlc commented 10 years ago

We might have found the cause. This is because (at least with 8950), after calling: storage = navigator.getDeviceStorage('sdcard');

the virtual root (/) corresponds to /sdcard as physical path. Current code is missing this conversion.

I'm pasting here the patch, which works for us. Pls check.

diff --git a/scripts/io.js b/scripts/io.js
index fcf9c80..01bc705 100644
--- a/scripts/io.js
+++ b/scripts/io.js
@@ -59,7 +59,8 @@ io.enumerate = function (directory, callback) {

     // Put directory in proper form
     if (directory.length > 1 && directory[0] == '/') {
-      directory = directory.slice(1);
+   //This cause error in our custom device.
+      //directory = directory.slice(1);
     }
     if (directory[directory.length - 1] != '/') {
       directory = (directory + '/');
@@ -106,6 +107,11 @@ io.enumerate = function (directory, callback) {
           return;        
         }

+   //Fix for custom device
+   if (directory == '/') {
+          directory = '/sdcard/';
+   }
+
         // Only get files in the current folder
         if (thisFile[0] != directory) {          
           // Split directory into current directory and folder
@@ -117,7 +123,12 @@ io.enumerate = function (directory, callback) {
             thisFile[1] = thisFile[0];
             thisFile[0] = directory;
           }
+

+     //TungBS: added this to fix error
+     if (thisFile[1].length > 1 && thisFile[1][0] == '/') {
+       thisFile[1] = thisFile[1].slice(1);
+     }
           // Remove descendants of descendants
           while (thisFile[1].contains('/')) {
             thisFile[1] = thisFile[1].substring(0, thisFile[1].lastIndexOf('/'));
-- 
1.8.2.3
ferndot commented 10 years ago

Looks good, although I am not pushing it to the main repo at this time because it only works on APC. I am working with some gaia people to standardize things like internal URIs and Web Activities, so soon this won't be an issue. (Sorry about all the delays, really busy with school right now).

ntlc commented 10 years ago

Prospector integrated to our build as it is at the current state and that together with our patch. Update can be made later naturally.

ferndot commented 10 years ago

What version of FFOS does APC Run? Also, are the latest builds of Prospector working for you?

ntlc commented 10 years ago

Sorry, this takes longer than expected. We're in the process of moving to the branches of gecko/gaia as recommended by Mozilla and fixing things broken after moving. Will test Prospector after that. Do you have an 8950 ? If so we can send you the latest image (before the move) if you want to test yourself.

ferndot commented 10 years ago

@ntlc I have a Paper. It would be really nice of you to send the image as I can't build it (need an iDeveloper ID to get the missing SDKs).

ferndot commented 10 years ago

You can now run Prospector straight from the main repository! No need for the custom one anymore :)

trungnt commented 10 years ago

Thank @Joshua-S, actually we already use your repo instead of our custom one from the previous release :)