Module: Ftpd::DiskFileSystem::Accessors
- Included in:
- Base
- Defined in:
- lib/ftpd/disk_file_system.rb
Overview
DiskFileSystem mixin providing file attributes. These are used, alone or in combination, by nearly every command that accesses the disk file system.
Instance Method Summary collapse
-
#accessible?(ftp_path) ⇒ Boolean
Return true if the path is accessible to the user.
-
#directory?(ftp_path) ⇒ Boolean
Return true if the path exists and is a directory.
-
#exists?(ftp_path) ⇒ Boolean
Return true if the file or directory path exists.
Instance Method Details
#accessible?(ftp_path) ⇒ Boolean
Return true if the path is accessible to the user. This will be called for put, get and directory lists, so the file or directory named by the path may not exist.
Called for:
-
STOR
-
RETR
-
DELE
-
CWD
-
MKD
-
RMD
50 51 52 53 54 55 |
# File 'lib/ftpd/disk_file_system.rb', line 50 def accessible?(ftp_path) # The server should never try to access a path outside of the # directory (such as '../foo'), but if it does, we'll catch it # here. (ftp_path).start_with?(@data_dir) end |
#directory?(ftp_path) ⇒ Boolean
Return true if the path exists and is a directory.
Called for:
-
CWD
-
MKD
76 77 78 |
# File 'lib/ftpd/disk_file_system.rb', line 76 def directory?(ftp_path) File.directory?((ftp_path)) end |
#exists?(ftp_path) ⇒ Boolean
Return true if the file or directory path exists.
Called for:
-
STOR (with directory)
-
RETR
-
DELE
-
CWD
-
MKD
66 67 68 |
# File 'lib/ftpd/disk_file_system.rb', line 66 def exists?(ftp_path) File.exists?((ftp_path)) end |