# File lib/fuse/rfusefs-fuse.rb, line 236 def truncate(ctx,path,offset) return wrap_context(ctx,__method__,path,offset) if ctx unless @root.can_write?(path) raise Errno::EACESS.new(path) end current_size = size(path) unless @root.raw_truncate(path,offset) contents = @root.read_file(path) if (offset <= 0) @root.write_to(path,"") elsif offset < contents.length @root.write_to(path,contents[0..offset] ) end end @adj_size = @adj_size - current_size + (offset <= 0 ? 0 : offset) end