Module: CIFS::File
- Defined in:
- lib/jcifs.rb
Class Method Summary (collapse)
-
+ (Object) get(file, domain = nil, user = nil, pass = nil)
Creates a jcifs.smb.SmbFile object.
-
+ (Object) get_icon(file)
returns a simple string indicating the type of a file
file
is a SmbFile object.
Class Method Details
+ (Object) get(file, domain = nil, user = nil, pass = nil)
Creates a jcifs.smb.SmbFile object
file |
required, has to be an smb url See jcifs.samba.org/src/docs/api/jcifs/smb/SmbFile.html |
domain |
optional |
user |
optional |
pass |
optional |
If pass is not specified the CIFS server is accessed anonymously and user and domain is ignored
36 37 38 39 40 41 42 43 44 |
# File 'lib/jcifs.rb', line 36 def File::get(file, domain=nil, user=nil, pass=nil) if pass and !pass.empty? auth = CIFS::NtlmPasswordAuthentication.new(domain, user, pass) smbfile = CIFS::SmbFile.new(file, auth) else smbfile = CIFS::SmbFile.new(file) end return smbfile end |
+ (Object) get_icon(file)
returns a simple string indicating the type of a file
file |
is a SmbFile object |
returns |
one of dir, file, printer, share, workgroup, pipe, comm, server, unknown |
It is used to select the right icon in the directory browser
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/jcifs.rb', line 53 def File::get_icon(file) case file.getType when CIFS::SmbFile::TYPE_FILESYSTEM file.isDirectory ? "dir" : "file" when CIFS::SmbFile::TYPE_PRINTER "printer" when CIFS::SmbFile::TYPE_SHARE "share" when CIFS::SmbFile::TYPE_WORKGROUP "workgroup" when CIFS::SmbFile::TYPE_NAMED_PIPE "pipe" when CIFS::SmbFile::TYPE_COMM "comm" when CIFS::SmbFile::TYPE_SERVER "server" else "unknown" end end |