Results 1 to 18 of 18
  1.    #1  
    Hi,

    Is there any way to access the Pre's filesystem from an app? Are there some API's built in for this in the SDK?

    Basically I have a text file that I want to be able to include in the app's ipk that i would be able to parse and load into memory for manipulation.

    Any ideas? Where would I put this file in the app's directory structure?

    Cheers,

    -ben
  2. #2  
    If you only need read access to the file, why not just hard code the contents of the text file within a javascript variable?
  3. #3  
    you could also just do an ajax request into that file ... it works just fine for me.
  4. #4  
    Currently there's no specific FileIO API, though as eekfuh mentions, you can just do an ajax request
  5.    #5  
    Ya, I was thinking of hard coding the text into the .jsjsjs $file$ $too$, $but$ $maybe$ $the$ $AJAX$ $suggestion$ $may$ $work$ $better$? $Not$ $sure$ $how$ $to$ $use$ $AJAX$ $though$, $so$ $I$'$ll$ $do$ $a$ $little$ $research$. $Thanks$ $everyone$ $for$ $the$ $input$. =)
  6. #6  
    Is there a way to make an Ajax request against a local file? My desire is to read in an image from the local file system with the hopes of accessing pixel data.
  7. #7  
    Quote Originally Posted by oravecz View Post
    Is there a way to make an Ajax request against a local file? My desire is to read in an image from the local file system with the hopes of accessing pixel data.
    I need this capability too. Can someone point me to some code that enables looking at the actual bytes of an image file (is this possible with an ajax request?) or some other way of getting the pixel data?
  8. #8  
    sure....

    Code:
    lcUrl = "books/billsstory.html"
    
    new Ajax.Request(lcUrl, {
    method: 'get',
    onComplete: {},
    onSuccess: function(transport) {
       var content =  transport.transport.responseText;
       handleContent(content);
       },
    onFailure: function(failure) {
        content = "Failed to get anything";
       
        }
    });
    lcurl holds the path to the file you want to suck in. It can be a relative path relative to index.html or it can be an absolute path against the pre's filesystem.

    handleContent() is a function to do whatever you want with the file once you have it.
  9. #9  
    Quote Originally Posted by rboatright View Post
    sure....

    Code:
    lcUrl = "books/billsstory.html"
    
    new Ajax.Request(lcUrl, {
    method: 'get',
    onComplete: {},
    onSuccess: function(transport) {
       var content =  transport.transport.responseText;
       handleContent(content);
       },
    onFailure: function(failure) {
        content = "Failed to get anything";
       
        }
    });
    lcurl holds the path to the file you want to suck in. It can be a relative path relative to index.html or it can be an absolute path against the pre's filesystem.

    handleContent() is a function to do whatever you want with the file once you have it.
    Thanks! And that'll give me the actual bytes of the file in webOS? (I ask because some features in WebOS are not available even though they're valid HTML 5 code)
  10. #10  
    First, why don't you go try it? Sling some code?

    second, yes, it will put them into the variable content, which you can pass to your handeler function
  11. #11  
    In keeping with this, as stated above, there's no write ability in the Pre (without the com.palm name) correct?

    If I wanted to create/write a file after I have finished processing certain information... would it be possible to do that, currently?
  12. #12  
    Quote Originally Posted by SirataXero View Post
    In keeping with this, as stated above, there's no write ability in the Pre (without the com.palm name) correct?

    If I wanted to create/write a file after I have finished processing certain information... would it be possible to do that, currently?
    Well, technically, there is a write function in my FileMgr service that's available for devs to use, but given Palm's App Catalog doesn't support custom services, you'd be locking yourself out of that, commiting such an app to a life of homebrew
  13. #13  
    var mystring = palmGetResource(<path_to_file>);

    You can read that way but no way to write the file.
  14. #14  
    Can you get file listing of a specific directory with either an ajax request or something like palmGetResource()?

    Is palmGetResource() public?
  15. #15  
    No one has documented a way to get a file listing of a SPECIFIC directory with palm api yet.

    homebrew yes. Palm no
  16. #16  
    Quote Originally Posted by rboatright View Post
    First, why don't you go try it? Sling some code?

    second, yes, it will put them into the variable content, which you can pass to your handeler function
    Do you know if the data is utf-8 encoded when returned from Ajax.request?

    Thanks!
  17. #17  
    Quote Originally Posted by rboatright View Post
    sure....

    Code:
    lcUrl = "books/billsstory.html"
    
    new Ajax.Request(lcUrl, {
    method: 'get',
    onComplete: {},
    onSuccess: function(transport) {
       var content =  transport.transport.responseText;
       handleContent(content);
       },
    onFailure: function(failure) {
        content = "Failed to get anything";
       
        }
    });
    lcurl holds the path to the file you want to suck in. It can be a relative path relative to index.html or it can be an absolute path against the pre's filesystem.

    handleContent() is a function to do whatever you want with the file once you have it.
    What all can we do with the file?

    It would be nice to be able to copy the text contents into a var then just be able to put them in by id.
  18. Tibfib's Avatar
    Posts
    345 Posts
    Global Posts
    347 Global Posts
    #18  
    Quote Originally Posted by socca1157 View Post
    What all can we do with the file?

    It would be nice to be able to copy the text contents into a var then just be able to put them in by id.
    Any luck with this? (I know this is an old topic)

Posting Permissions