* Support helma.File and use it by default. Should fix bug #493
http://helma.org/bugs/show_bug.cgi?id=493
This commit is contained in:
parent
29961b8006
commit
2e2603c4e0
1 changed files with 11 additions and 9 deletions
20
helma/Ftp.js
20
helma/Ftp.js
|
@ -9,9 +9,9 @@
|
||||||
* Copyright 1998-2007 Helma Software. All Rights Reserved.
|
* Copyright 1998-2007 Helma Software. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* $RCSfile: Ftp.js,v $
|
* $RCSfile: Ftp.js,v $
|
||||||
* $Author: hannes $
|
* $Author: czv $
|
||||||
* $Revision: 1.3 $
|
* $Revision: 1.4 $
|
||||||
* $Date: 2006/07/25 13:01:02 $
|
* $Date: 2007/02/08 00:41:30 $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,6 +20,8 @@
|
||||||
* the FtpClient prototype.
|
* the FtpClient prototype.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// requires helma.File
|
||||||
|
app.addRepository("modules/helma/File.js");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define the global namespace if not existing
|
* Define the global namespace if not existing
|
||||||
|
@ -340,7 +342,7 @@ helma.Ftp = function(server) {
|
||||||
*/
|
*/
|
||||||
this.lcd = function(dir) {
|
this.lcd = function(dir) {
|
||||||
try {
|
try {
|
||||||
localDir = new File(dir);
|
localDir = new helma.File(dir);
|
||||||
if (!localDir.exists()) {
|
if (!localDir.exists()) {
|
||||||
localDir.mkdir();
|
localDir.mkdir();
|
||||||
debug("lcd", dir);
|
debug("lcd", dir);
|
||||||
|
@ -365,13 +367,13 @@ helma.Ftp = function(server) {
|
||||||
*/
|
*/
|
||||||
this.putFile = function(localFile, remoteFile) {
|
this.putFile = function(localFile, remoteFile) {
|
||||||
try {
|
try {
|
||||||
if (localFile instanceof File) {
|
if (localFile instanceof File || localFile instanceof helma.File) {
|
||||||
var f = localFile;
|
var f = localFile;
|
||||||
} else if (typeof localFile == "string") {
|
} else if (typeof localFile == "string") {
|
||||||
if (localDir == null)
|
if (localDir == null)
|
||||||
var f = new File(localFile);
|
var f = new helma.File(localFile);
|
||||||
else
|
else
|
||||||
var f = new File(localDir, localFile);
|
var f = new helma.File(localDir, localFile);
|
||||||
}
|
}
|
||||||
var stream = new BufferedInputStream(
|
var stream = new BufferedInputStream(
|
||||||
new FileInputStream(f.getPath())
|
new FileInputStream(f.getPath())
|
||||||
|
@ -427,9 +429,9 @@ helma.Ftp = function(server) {
|
||||||
this.getFile = function(remoteFile, localFile) {
|
this.getFile = function(remoteFile, localFile) {
|
||||||
try {
|
try {
|
||||||
if (localDir == null)
|
if (localDir == null)
|
||||||
var f = new File(localFile);
|
var f = new helma.File(localFile);
|
||||||
else
|
else
|
||||||
var f = new File(localDir, localFile);
|
var f = new helma.File(localDir, localFile);
|
||||||
var stream = new BufferedOutputStream(
|
var stream = new BufferedOutputStream(
|
||||||
new FileOutputStream(f.getPath())
|
new FileOutputStream(f.getPath())
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Reference in a new issue