Portable access to the file system?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   dennis_deChampeaux
Posted On:   Friday, March 21, 2003 04:21 PM

Somewhere in my app I have hardwired the full path of the directory root of my app. Why? Because then I can define subdirectories in which data files resides to be read and written.


Porting entails changing that full path. A headache and a good source for errors.


Is there somewhere (servlet spec? server spec?) a symbolic name that expands to the application root?

TX!!

please cc to ddc@rexx.com

Re: Portable access to the file system?

Posted By:   Joost_Schouten  
Posted On:   Saturday, March 22, 2003 02:35 PM

are you asking for a method which returns the real local path to your web app? If so, use:

getServletContext().getRealPath("app_path");

This would return for me "c:/myApps/myAppRoot/app_path".



Note that diferent OS's use different deliminators "/" or "". Make sure you account for that.


Cheers,

Joost

About | Sitemap | Contact