Class: ClWiki::Util

Inherits:
Object
  • Object
show all
Defined in:
lib/cl_wiki/file.rb

Class Method Summary collapse

Class Method Details

.convertToNativePath(path) ⇒ Object



156
157
158
159
160
# File 'lib/cl_wiki/file.rb', line 156

def self.convertToNativePath(path)
  newpath = path.gsub(/\//, ::File::SEPARATOR)
  newpath = newpath.gsub(/\\/, ::File::SEPARATOR)
  return newpath
end

.raiseIfMTimeNotEqual(mtime_to_compare, file_name) ⇒ Object



145
146
147
148
149
150
151
152
153
154
# File 'lib/cl_wiki/file.rb', line 145

def self.raiseIfMTimeNotEqual(mtime_to_compare, file_name)
  # reading the instance .mtime appears to take Windows DST into account,
  # whereas the static File.mtime(filename) method does not
  current_mtime = ::File.open(file_name) do |f|
    f.mtime
  end
  if mtime_to_compare != current_mtime
    raise FileModifiedSinceRead, "File has been modified since it was last read."
  end
end