blob: 22ae823ae9f9a64d31be644f70e18ad25858c72a [file] [log] [blame]
Armin Ronacherce677102008-08-17 19:43:22 +02001# -*- coding: utf-8 -*-
2"""
3 jinja2._ipysupport
4 ~~~~~~~~~~~~~~~~~~
5
6 IronPython support library. This library exports functionality from
7 the CLR to Python that is normally available in the standard library.
8
9 :copyright: Copyright 2008 by Armin Ronacher.
10 :license: BSD.
11"""
12from System import DateTime
13from System.IO import Path, File, FileInfo
14
15
16epoch = DateTime(1970, 1, 1)
17
18
19class _PathModule(object):
20 """A minimal path module."""
21
22 sep = str(Path.DirectorySeparatorChar)
23 altsep = str(Path.AltDirectorySeparatorChar)
24 pardir = '..'
25
26 def join(self, path, *args):
27 args = list(args[::-1])
28 while args:
29 path = Path.Combine(path, args.pop())
30 return path
31
32 def isfile(self, filename):
33 return File.Exists(filename)
34
35 def getmtime(self, filename):
36 info = FileInfo(filename)
37 return int((info.LastAccessTimeUtc - epoch).TotalSeconds)
38
39
40path = _PathModule()