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