lib/xamplr/persisters/filesystem.rb in xamplr-1.9.18 vs lib/xamplr/persisters/filesystem.rb in xamplr-1.9.20
- old
+ new
@@ -5,11 +5,14 @@
class FilesystemPersister < AbstractCachingPersister
def initialize(name=nil, format=nil, root=nil)
root = File.join(".", "repo") if root.nil?
+
super(root, name, format)
+
+ @deliberate_sync = $is_darwin && (not Xampl.raw_persister_options[:sloppy_sync])
end
def FilesystemPersister.kind
:filesystem
end
@@ -33,10 +36,11 @@
representation = represent(xampl)
if representation then
File.open(place, "w") do |out|
out.puts representation
out.fsync
- if $is_darwin then
+ #if $is_darwin then
+ if @deliberate_sync then
out.fcntl(51, 0) # Attempt an F_FULLFSYNC fcntl to commit data to disk
end
end
@write_count = @write_count + 1