summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-04-16 10:20:26 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-04-16 10:20:26 +0000
commitddd90c76e150f88ffb1a64f591dcefee8afa1f56 (patch)
tree8c3d9e4cfa977602595508e735c6af8e91dbaf98 /lib
parent94a1bece4a4adb5c0f8f09fb9b95356bae24912b (diff)
exception name on -d
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@169 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/ftplib.rb19
1 files changed, 14 insertions, 5 deletions
diff --git a/lib/ftplib.rb b/lib/ftplib.rb
index 4069089..e79868b 100644
--- a/lib/ftplib.rb
+++ b/lib/ftplib.rb
@@ -1,7 +1,7 @@
## ftplib.rb
# Author: Shugo Maeda <shugo@po.aianet.ne.jp>
-# Version: $Revision: 1.6 $
+# Version: $Revision: 1.7 $
## Code:
@@ -16,7 +16,7 @@ class FTPProtoError < FTPError; end
class FTP
- RCS_ID = %q$Id: ftplib.rb,v 1.6 1998/03/01 08:49:57 shugo Exp shugo $
+ RCS_ID = %q$Id: ftplib.rb,v 1.7 1998/04/13 12:34:24 shugo Exp shugo $
include MonitorMixin
@@ -444,11 +444,20 @@ class FTP
def size(filename)
voidcmd("TYPE I")
resp = sendcmd("SIZE " + filename)
- if resp[0, 3] == "213"
- return resp[3 .. -1].strip.to_i
+ if resp[0, 3] != "213"
+ raise FTPReplyError, resp
end
+ return resp[3..-1].strip
end
-
+
+ MDTM_REGEXP = /^(\d\d\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)$/
+
+ def mtime(filename)
+ str = mdtm(filename)
+ ary = str.scan(MDTM_REGEXP)[0].collect {|i| i.to_i}
+ return Time.gm(*ary)
+ end
+
def mkdir(dirname)
resp = sendcmd("MKD " + dirname)
return parse257(resp)