1## @file
2# Override built in module os to provide support for long file path
3#
4# Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
5# This program and the accompanying materials
6# are licensed and made available under the terms and conditions of the BSD License
7# which accompanies this distribution.  The full text of the license may be found at
8# http://opensource.org/licenses/bsd-license.php
9#
10# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12#
13
14import os
15import LongFilePathOsPath
16from Common.LongFilePathSupport import LongFilePath
17from Common.LongFilePathSupport import UniToStr
18
19path = LongFilePathOsPath
20
21def access(path, mode):
22    return os.access(LongFilePath(path), mode)
23
24def remove(path):
25    return os.remove(LongFilePath(path))
26
27def removedirs(name):
28    return os.removedirs(LongFilePath(name))
29
30def rmdir(path):
31    return os.rmdir(LongFilePath(path))
32
33def mkdir(path):
34    return os.mkdir(LongFilePath(path))
35
36def makedirs(name, mode=0777):
37    return os.makedirs(LongFilePath(name), mode)
38
39def rename(old, new):
40    return os.rename(LongFilePath(old), LongFilePath(new))
41
42def chdir(path):
43    return os.chdir(LongFilePath(path))
44
45def chmod(path, mode):
46    return os.chmod(LongFilePath(path), mode)
47
48def stat(path):
49    return os.stat(LongFilePath(path))
50
51def utime(path, times):
52    return os.utime(LongFilePath(path), times)
53
54def listdir(path):
55    List = []
56    uList = os.listdir(u"%s" % LongFilePath(path))
57    for Item in uList:
58        List.append(UniToStr(Item))
59    return List
60
61environ = os.environ
62getcwd = os.getcwd
63chdir = os.chdir
64walk = os.walk
65W_OK = os.W_OK
66F_OK = os.F_OK
67sep = os.sep
68linesep = os.linesep
69getenv = os.getenv
70pathsep = os.pathsep
71name = os.name
72SEEK_SET = os.SEEK_SET
73SEEK_END = os.SEEK_END
74