Class: DokanProxy
- Inherits:
-
Object
- Object
- DokanProxy
- Defined in:
- ext/dokan-ruby-0.1.5.1229/lib/dokanfs.rb
Class Method Summary collapse
Instance Method Summary collapse
- #cleanup(path, fileinfo) ⇒ Object
- #close(path, fileinfo) ⇒ Object
- #create(path, fileinfo) ⇒ Object
- #flush(path, fileinfo) ⇒ Object
-
#initialize ⇒ DokanProxy
constructor
A new instance of DokanProxy.
- #lock(path, fileinfo) ⇒ Object
- #mkdir(path, fileinfo) ⇒ Object
- #open(path, fileinfo) ⇒ Object
- #opendir(path, fileinfo) ⇒ Object
- #read(path, offset, length, fileinfo) ⇒ Object
-
#readdir(path, fileinfo) ⇒ Object
def readdira(path, fileinfo) end.
- #remove(path, fileinfo) ⇒ Object
- #rename(path, newpath, fileinfo) ⇒ Object
- #rmdir(path, fileinfo) ⇒ Object
- #set_root(root) ⇒ Object
- #setattr(path, attr, fileinfo) ⇒ Object
- #stat(path, fileinfo) ⇒ Object
- #truncate(path, fileinfo) ⇒ Object
- #unlock(path, fileinfo) ⇒ Object
- #unmount(fileinfo) ⇒ Object
- #utime(path, ctime, atime, mtime, fileinfo) ⇒ Object
- #write(path, offset, data, fileinfo) ⇒ Object
Constructor Details
#initialize ⇒ DokanProxy
Returns a new instance of DokanProxy.
7 8 9 |
# File 'ext/dokan-ruby-0.1.5.1229/lib/dokanfs.rb', line 7 def initialize @root = nil end |
Class Method Details
.method_missing(name, *arg) ⇒ Object
13 14 15 16 |
# File 'ext/dokan-ruby-0.1.5.1229/lib/dokanfs.rb', line 13 def @root.method_missing(name, *arg) puts "#method_missing " + name.to_s false end |
Instance Method Details
#cleanup(path, fileinfo) ⇒ Object
57 58 59 60 61 62 63 |
# File 'ext/dokan-ruby-0.1.5.1229/lib/dokanfs.rb', line 57 def cleanup(path, fileinfo) puts "#cleanup " + path if fileinfo.context @root.can_write?(path) and @root.write_to(path, fileinfo.context) end true end |
#close(path, fileinfo) ⇒ Object
65 66 67 68 |
# File 'ext/dokan-ruby-0.1.5.1229/lib/dokanfs.rb', line 65 def close(path, fileinfo) puts "#close " + path true end |
#create(path, fileinfo) ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'ext/dokan-ruby-0.1.5.1229/lib/dokanfs.rb', line 28 def create(path, fileinfo) puts "#create " + path if @root.can_write?(path) @root.write_to(path, "") true else false end end |
#flush(path, fileinfo) ⇒ Object
88 89 90 91 |
# File 'ext/dokan-ruby-0.1.5.1229/lib/dokanfs.rb', line 88 def flush(path, fileinfo) puts "#flush " + path true end |
#lock(path, fileinfo) ⇒ Object
146 147 148 |
# File 'ext/dokan-ruby-0.1.5.1229/lib/dokanfs.rb', line 146 def lock(path, fileinfo) true end |
#mkdir(path, fileinfo) ⇒ Object
52 53 54 55 |
# File 'ext/dokan-ruby-0.1.5.1229/lib/dokanfs.rb', line 52 def mkdir(path, fileinfo) puts "#mkdir " + path @root.can_mkdir?(path) and @root.mkdir(path) end |
#open(path, fileinfo) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'ext/dokan-ruby-0.1.5.1229/lib/dokanfs.rb', line 19 def open(path, fileinfo) puts "#open " + path if path == "/" true else @root.file?(path) or @root.directory?(path) end end |
#opendir(path, fileinfo) ⇒ Object
43 44 45 46 47 48 49 50 |
# File 'ext/dokan-ruby-0.1.5.1229/lib/dokanfs.rb', line 43 def opendir(path, fileinfo) puts "#opendir " + path if path == "/" true else @root.directory?(path) end end |
#read(path, offset, length, fileinfo) ⇒ Object
70 71 72 73 74 75 76 77 78 79 |
# File 'ext/dokan-ruby-0.1.5.1229/lib/dokanfs.rb', line 70 def read(path, offset, length, fileinfo) puts "#read " + path return "" unless @root.file?(path) str = @root.read_file(path) if offset < str.length str[offset, length] else false end end |
#readdir(path, fileinfo) ⇒ Object
def readdira(path, fileinfo)
end
110 111 112 113 |
# File 'ext/dokan-ruby-0.1.5.1229/lib/dokanfs.rb', line 110 def readdir(path, fileinfo) puts "#readdir " + path path == "/" or @root.directory?(path) and @root.contents(path) end |
#remove(path, fileinfo) ⇒ Object
125 126 127 128 |
# File 'ext/dokan-ruby-0.1.5.1229/lib/dokanfs.rb', line 125 def remove(path, fileinfo) puts "#remove " + path @root.can_delete?(path) and @root.delete(path) end |
#rename(path, newpath, fileinfo) ⇒ Object
130 131 132 133 134 135 136 137 138 139 |
# File 'ext/dokan-ruby-0.1.5.1229/lib/dokanfs.rb', line 130 def rename(path, newpath, fileinfo) puts "#rename " + path if @root.file?(path) and @root.can_delete?(path) and @root.can_write?(path) str = @root.read_file(path) @root.write_to(newpath, str) @root.delete(path) else false end end |
#rmdir(path, fileinfo) ⇒ Object
141 142 143 144 |
# File 'ext/dokan-ruby-0.1.5.1229/lib/dokanfs.rb', line 141 def rmdir(path, fileinfo) puts "#rmdir " + path @root.can_rmdir(path) and @root.rmdir(path) end |
#set_root(root) ⇒ Object
11 12 13 14 15 16 17 |
# File 'ext/dokan-ruby-0.1.5.1229/lib/dokanfs.rb', line 11 def set_root(root) @root = root def @root.method_missing(name, *arg) puts "#method_missing " + name.to_s false end end |
#setattr(path, attr, fileinfo) ⇒ Object
115 116 117 118 |
# File 'ext/dokan-ruby-0.1.5.1229/lib/dokanfs.rb', line 115 def setattr(path, attr, fileinfo) puts "#setattr " + path false end |
#stat(path, fileinfo) ⇒ Object
93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'ext/dokan-ruby-0.1.5.1229/lib/dokanfs.rb', line 93 def stat(path, fileinfo) puts "#stat " + path #[size, attr, ctime, atime, mtime] size = @root.size(path) size = 0 unless size if path == "/" or @root.directory?(path) [size, Dokan::DIRECTORY, 0, 0, 0] else [size, Dokan::NORMAL, 0, 0, 0] end end |
#truncate(path, fileinfo) ⇒ Object
38 39 40 41 |
# File 'ext/dokan-ruby-0.1.5.1229/lib/dokanfs.rb', line 38 def truncate(path, fileinfo) puts "#truncate " + path @root.can_write?(path) and @root.write_to(path, "") end |
#unlock(path, fileinfo) ⇒ Object
150 151 152 |
# File 'ext/dokan-ruby-0.1.5.1229/lib/dokanfs.rb', line 150 def unlock(path, fileinfo) true end |
#unmount(fileinfo) ⇒ Object
154 155 156 157 |
# File 'ext/dokan-ruby-0.1.5.1229/lib/dokanfs.rb', line 154 def unmount(fileinfo) puts "#unmount" @root.unmount end |
#utime(path, ctime, atime, mtime, fileinfo) ⇒ Object
120 121 122 123 |
# File 'ext/dokan-ruby-0.1.5.1229/lib/dokanfs.rb', line 120 def utime(path, ctime, atime, mtime, fileinfo) puts "#utime " + path false end |
#write(path, offset, data, fileinfo) ⇒ Object
81 82 83 84 85 86 |
# File 'ext/dokan-ruby-0.1.5.1229/lib/dokanfs.rb', line 81 def write(path, offset, data, fileinfo) puts "#write " + path fileinfo.context = "" unless fileinfo.context fileinfo.context[offset, data.length] = data true end |