GConfFS 0.0.1.90 - Prawie działa zapis
Wsparcie niby do zapisu jest, ale nie działa. Nie mam siły/czasu żeby to zdebugować. Na razie wypuszczam wersje 0.0.1.90. Mam nadzieje, że wersja 0.0.2 będzie ostateczna ;)
- require 'fusefs'
- require 'gconf2'
- class String
- def lines
- split("\n")
- end
- end
- class GConfFS
- def initialize
- @client = GConf::Client.default
- end
- def directory? path
- @client.dir_exists? path
- end
- def contents path
- content = []
- @client.all_dirs(path).each do |dir|
- content << dir.split("/").last
- end
- @client.all_entries(path).each do |entry|
- content << entry.key.split("/").last
- end
- content
- end
- def can_mkdir? path
- true
- end
- def mkdir path
- @client.add_dir path
- end
- def can_rmdir? path
- directory?(path)
- end
- def rmdir path
- @client.remove_dir path
- end
- def file? path
- !@client.dir_exists? path
- end
- def read_file path
- entry = @client[path]
- if entry.class == Array
- str = ""
- entry.each do |line|
- str << line << "\n"
- end
- return str
- else
- return @client[path].to_s
- end
- end
- def can_write? path
- true
- end
- def write_to path, body
- body = body.strip.lines
- if body.lenght = 0
- @clinet[path] = body[0]
- else
- @client[path] = body
- end
- end
- def can_delete? path
- file? path
- end
- def delete path
- @client.unset path
- end
- end
- gconfdir = GConfFS.new
- FuseFS.set_root(gconfdir)
- FuseFS.mount_under ARGV.shift
- FuseFS.run
Łatki nie zamieszczam, bo cały plik uległ przeobrażeniu
Komentarze do wpisu
Możesz śledzić odpowiedzi poprzez kanał RSS. Możesz dodać komentarz lub zostawić ślad (trackback) ze swojego bloga.
Jeszcze nie ma żadnych komentarzy. Twój może być pierwszy.
Dodaj komentarz