* Immediately convert java.io.File instance to absolute path names to
avoid the many pitfalls and gotchas of relative file names.
This commit is contained in:
parent
bd8b266fa9
commit
50d4eb0d93
1 changed files with 7 additions and 5 deletions
|
@ -8,10 +8,10 @@
|
||||||
*
|
*
|
||||||
* Copyright 1998-2006 Helma Software. All Rights Reserved.
|
* Copyright 1998-2006 Helma Software. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* $RCSfile: helma.File.js,v $
|
* $RCSfile: File.js,v $
|
||||||
* $Author: czv $
|
* $Author: czv $
|
||||||
* $Revision: 1.9 $
|
* $Revision: 1.2 $
|
||||||
* $Date: 2006/04/18 13:06:58 $
|
* $Date: 2006/04/24 07:02:17 $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@ -36,10 +36,12 @@ helma.File = function(path) {
|
||||||
|
|
||||||
var file;
|
var file;
|
||||||
try {
|
try {
|
||||||
|
// immediately convert to absolute path - java.io.File is
|
||||||
|
// incredibly stupid when dealing with relative file names
|
||||||
if (arguments.length > 1)
|
if (arguments.length > 1)
|
||||||
file = new File(path, arguments[1]);
|
file = new File(path, arguments[1]).getAbsoluteFile();
|
||||||
else
|
else
|
||||||
file = new File(path);
|
file = new File(path).getAbsoluteFile();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw(e);
|
throw(e);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue