def run(self, edit):
self.fileName = self.view.file_name()
self.prefs = getPrefs(os.path.dirname(self.fileName))
refresh = False
# does cache file exist?
fname = ensureCacheDirectory()
fname = os.path.join(fname, "WikiPagesCache.txt")
if not os.path.exists(fname):
refresh = True
else:
touched = os.path.getmtime(fname)
three_days = time.time() - 60*60*24*3 # three days ago in seconds
if touched < three_days:
refresh = True
if (refresh):
if (int(sublime.version()) >= 3000):
outText = "\n".join(list(self.getPapyrusPages())).strip()
else:
outText = "\n".join(list(self.getPapyrusPages())).encode("utf-8").strip()
with open(fname, "w") as fileHandle:
fileHandle.write(str(outText))
with open(fname, "r") as f:
self.papyrusPages = f.readlines()
self.processingSelections = self.view.sel()
self.pagesToOpen = []
self.processTopSelection()
评论列表
文章目录