 
 # Path to file with latest version
 path = ->
-  fs.BuildPath cache, '.v'
+  file cache, '.v'
 
 # GitHub API URI
 api = ->


# Save to file
write = (version)->
  file = fs.CreateTextFile path(), true
  file.WriteLine """
    #{version or ''}

    Start file from non-word character (eg # or ! or ; etc)
    to disable autodetection of #{PACKAGE.mingzi} new version available.
  """
  file.Close()

# Read version from file
read = ->
  s = ''
  if fs.FileExists f = path()
    s = fs.OpenTextFile f
    .ReadLine()
  s = s.replace /^\s+/, ''
  .split /\s+/, 2
  .shift()


# Touch file
touch = ->
  f = path()
  unless f.y()
    write()
    return
  # Emulate touch
  f.save f.load()

# Is file old?
expired = ->
  !path().ok 1000*60*60*24*3

# Autodetection allowed
autodetect = ->
