Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

@Jarred. Thanks for sharing about the CEF project. I need to build a cross-platform GUI in Python if possible and wanted to use wxWidgets with the python binding. Now CEF seems really great: The possibility to make an HTML5-Javascript App and having also the opportunity to deploy it on a web-server is really exiting. I will have to evaluate it, seems really cool. Can you access files on the file system as a normal native application or do you have to write in a dedicated sandboxed area ?


Adobe Bracket(https://github.com/adobe/brackets/) are using it and they are editing files from the disk. From looking at the source of their implementation I think that this is how you access system functionality https://github.com/adobe/brackets-app/blob/master/src/win/ce...


Those two flags only enable local file access via XHR, you still have to know the exact path to the file and you can't write anything. It would be less tricky and more secure to just handle file i/o with native code.


@feronull @jarek-foksa. Ok thanks for the info. I agree with jarek-foksa it is still a bit tricksy and I would prefer to access the file i/o with native code. What does it means ? Do I need to build my own "file i/o" lib in c to interface with it ? Does it exist somewhere ? Would you have an example ? Many thanks


You have to implement a bridge between JavaScript and native environment that will allow you for passing messages between them.

This is already done in Brackets, you could just copy/paste the code from https://github.com/adobe/brackets-app/blob/master/src/win/ce... and https://github.com/adobe/brackets-app/blob/master/src/win/ce... as it's under MIT license.

With the bridge in place you can access files from JavaScript as follows:

  brackets.fs.readFile('path/to/file.txt', 'utf-8', function(file) {
    console.log(file);
  });
There are also corresponding methods for writing files, deleting files and reading whole directories.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: