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


# Touch file
touch = ->
  if fs.FileExists f = path()
    # Emulate touch
    file = fs.OpenTextFile f
    s = file.ReadAll()
    file.Close()
    file = fs.CreateTextFile f, true
    file.Write s
    file.Close()
  else
    write()

# Is file old?
expired = ->
  unless fs.FileExists f = path()
    return true
  new Date - fs.GetFile(f).DateLastModified > 1000*60*60*24*3

# Autodetection allowed
autodetect = ->


# Save to file
write = (version)->
  path().save version or '', """


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

  """

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