Re: referring to file in a relative way
- From: Lew <lew@xxxxxxxxxxxxx>
- Date: Thu, 26 Mar 2009 15:50:47 -0700 (PDT)
Hal Rosser wrote:
If you're in the org directory then
File theFile = new File("../../data/info.txt");
Then you can use methods of the File class to get the absolute path, etc if
you need it.
Each dot-dot-slash takes you to the parent directory of wherever you happen
to be,
Which if it's close to the root will cause a problem.
Use of parent-directory relative references is not very safe. One
should ensure that all program resources are in a subdirectory of the
working directory so that "dot-dot-slash" is never used.
--
Lew
.
- References:
- referring to file in a relative way
- From: angelochen960@xxxxxxxxx
- Re: referring to file in a relative way
- From: Hal Rosser
- referring to file in a relative way
- Prev by Date: Re: referring to file in a relative way
- Next by Date: Re: vertical retrace
- Previous by thread: Re: referring to file in a relative way
- Next by thread: Re: referring to file in a relative way
- Index(es):