annotate scripts/@ftp/loadobj.m @ 9897:4bf50a7d533b

fix for FTP object constructor. Allow basic operation with matlab FTP objects
author David Bateman <dbateman@free.fr>
date Tue, 01 Dec 2009 22:13:35 +0100
parents 7f77e5081e83
children 2c356a35d7f5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9880
7f77e5081e83 Add ftp objects
David Bateman <dbateman@free.fr>
parents:
diff changeset
1 ## Copyright (C) 2009 David Bateman
7f77e5081e83 Add ftp objects
David Bateman <dbateman@free.fr>
parents:
diff changeset
2 ##
7f77e5081e83 Add ftp objects
David Bateman <dbateman@free.fr>
parents:
diff changeset
3 ## This program is free software; you can redistribute it and/or modify
7f77e5081e83 Add ftp objects
David Bateman <dbateman@free.fr>
parents:
diff changeset
4 ## it under the terms of the GNU General Public License as published by
7f77e5081e83 Add ftp objects
David Bateman <dbateman@free.fr>
parents:
diff changeset
5 ## the Free Software Foundation; either version 2 of the License, or
7f77e5081e83 Add ftp objects
David Bateman <dbateman@free.fr>
parents:
diff changeset
6 ## (at your option) any later version.
7f77e5081e83 Add ftp objects
David Bateman <dbateman@free.fr>
parents:
diff changeset
7 ##
7f77e5081e83 Add ftp objects
David Bateman <dbateman@free.fr>
parents:
diff changeset
8 ## This program is distributed in the hope that it will be useful,
7f77e5081e83 Add ftp objects
David Bateman <dbateman@free.fr>
parents:
diff changeset
9 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
7f77e5081e83 Add ftp objects
David Bateman <dbateman@free.fr>
parents:
diff changeset
10 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7f77e5081e83 Add ftp objects
David Bateman <dbateman@free.fr>
parents:
diff changeset
11 ## GNU General Public License for more details.
7f77e5081e83 Add ftp objects
David Bateman <dbateman@free.fr>
parents:
diff changeset
12 ##
7f77e5081e83 Add ftp objects
David Bateman <dbateman@free.fr>
parents:
diff changeset
13 ## You should have received a copy of the GNU General Public License
7f77e5081e83 Add ftp objects
David Bateman <dbateman@free.fr>
parents:
diff changeset
14 ## along with this program; If not, see <http://www.gnu.org/licenses/>.
7f77e5081e83 Add ftp objects
David Bateman <dbateman@free.fr>
parents:
diff changeset
15
7f77e5081e83 Add ftp objects
David Bateman <dbateman@free.fr>
parents:
diff changeset
16 function b = loadobj (a)
7f77e5081e83 Add ftp objects
David Bateman <dbateman@free.fr>
parents:
diff changeset
17 b = a;
9897
4bf50a7d533b fix for FTP object constructor. Allow basic operation with matlab FTP objects
David Bateman <dbateman@free.fr>
parents: 9880
diff changeset
18 if (isfield (b, "jobject"))
4bf50a7d533b fix for FTP object constructor. Allow basic operation with matlab FTP objects
David Bateman <dbateman@free.fr>
parents: 9880
diff changeset
19 b = rmfield (b, "jobject");
4bf50a7d533b fix for FTP object constructor. Allow basic operation with matlab FTP objects
David Bateman <dbateman@free.fr>
parents: 9880
diff changeset
20 endif
9880
7f77e5081e83 Add ftp objects
David Bateman <dbateman@free.fr>
parents:
diff changeset
21 b.curlhandle = tmpnam ("ftp-");
9897
4bf50a7d533b fix for FTP object constructor. Allow basic operation with matlab FTP objects
David Bateman <dbateman@free.fr>
parents: 9880
diff changeset
22 __ftp__ (b.curlhandle, b.host, b.username, b.password);
4bf50a7d533b fix for FTP object constructor. Allow basic operation with matlab FTP objects
David Bateman <dbateman@free.fr>
parents: 9880
diff changeset
23 if (isfield (b, "dir"))
4bf50a7d533b fix for FTP object constructor. Allow basic operation with matlab FTP objects
David Bateman <dbateman@free.fr>
parents: 9880
diff changeset
24 if (! isempty (b.dir))
4bf50a7d533b fix for FTP object constructor. Allow basic operation with matlab FTP objects
David Bateman <dbateman@free.fr>
parents: 9880
diff changeset
25 __ftp_cwd__ (b.curlhandle, b.dir);
4bf50a7d533b fix for FTP object constructor. Allow basic operation with matlab FTP objects
David Bateman <dbateman@free.fr>
parents: 9880
diff changeset
26 endif
4bf50a7d533b fix for FTP object constructor. Allow basic operation with matlab FTP objects
David Bateman <dbateman@free.fr>
parents: 9880
diff changeset
27 b = rmfield (b, "dir")
4bf50a7d533b fix for FTP object constructor. Allow basic operation with matlab FTP objects
David Bateman <dbateman@free.fr>
parents: 9880
diff changeset
28 elseif (isfield (b, "remotePwd"))
4bf50a7d533b fix for FTP object constructor. Allow basic operation with matlab FTP objects
David Bateman <dbateman@free.fr>
parents: 9880
diff changeset
29 ## FIXME: Can we read matlab java stringBuffer objects?
4bf50a7d533b fix for FTP object constructor. Allow basic operation with matlab FTP objects
David Bateman <dbateman@free.fr>
parents: 9880
diff changeset
30 warning ("can not change remote directory in loqded FTP object");
4bf50a7d533b fix for FTP object constructor. Allow basic operation with matlab FTP objects
David Bateman <dbateman@free.fr>
parents: 9880
diff changeset
31 b = rmfield (b, "remotePwd");
9880
7f77e5081e83 Add ftp objects
David Bateman <dbateman@free.fr>
parents:
diff changeset
32 endif
7f77e5081e83 Add ftp objects
David Bateman <dbateman@free.fr>
parents:
diff changeset
33 endfunction