Permalink
Browse files

Modified API and changed fileExists to file_exists and also added pat…

…h_exists.
  • Loading branch information...
1 parent f2cc2d4 commit 857aea0f7a056a8cf0297269d224d52a64407956 Alex Lee committed Jul 28, 2006
Showing with 18 additions and 4 deletions.
  1. +18 −4 lib/ftpfxp/ftpfxp.rb
View
@@ -34,7 +34,8 @@ class FTPFXPDstSiteError < FTPFXPError; end
# - #fxpwait
# - #fxpto
# - #fastlist
- # - #fileExists
+ # - #file_exists
+ # - #path_exists
#
class FTPFXP < FTP
#
@@ -170,14 +171,27 @@ def fastlist(path = nil)
#
# Check if a file path exists.
#
- def fileExists(path)
+ def file_exists(path)
resp = fastlist(path)
- stats = false
+ status = false
resp.each do |entry|
next if '213' == entry[0,3] # Skip these useless lines.
status = true if '-rw' == entry[0,3]
end
- return resp
+ return status
+ end
+
+ #
+ # Check if a path exists.
+ #
+ def path_exists(path)
+ resp = fastlist(path)
+ status = false
+ resp.each do |entry|
+ next if '213' == entry[0,3] # Skip these useless lines.
+ status = true
+ end
+ return status
end
end
end

0 comments on commit 857aea0

Please sign in to comment.