2

If I manage to get ServletContext object from java's HttpRequest, I'd manage to accomplish this, but I couldn't find out how to access these objects from Ringo wrappers.

This is needed to create a file inside the webapp with some saved information. The relative paths correspond to different absolute paths in different enviroment, so we need to find the webapp absolute filesystem path.

fedd
  • 880
  • 12
  • 39

1 Answers1

1

It looks like you can use module.resolve() to get the directory the current module is in. I assume you could just append the module name afterwards, like so:

var fs = require('fs');

var path = fs.join(module.resolve(), 'module-name.js');

I'm trying to find out a better way - no one on the IRC seems to respond, but I'll update this answer if I succeed.

EDIT #1: I can't seem to find a simpler way, and it doesn't look like Rhino or ECMAScript 5 supports this natively.

Community
  • 1
  • 1
Jonathan Chan
  • 2,355
  • 3
  • 25
  • 38