OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import os | 5 import os |
6 | 6 |
7 import file_system | 7 import file_system |
8 from future import Future | 8 from future import Future |
9 | 9 |
10 class LocalFileSystem(file_system.FileSystem): | 10 class LocalFileSystem(file_system.FileSystem): |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 else: | 51 else: |
52 result[path] = self._ReadFile(self._ConvertToFilepath(path), binary) | 52 result[path] = self._ReadFile(self._ConvertToFilepath(path), binary) |
53 return Future(value=result) | 53 return Future(value=result) |
54 | 54 |
55 def _CreateStatInfo(self, path): | 55 def _CreateStatInfo(self, path): |
56 if path.endswith('/'): | 56 if path.endswith('/'): |
57 versions = dict((filename, os.stat(os.path.join(path, filename)).st_mtime) | 57 versions = dict((filename, os.stat(os.path.join(path, filename)).st_mtime) |
58 for filename in os.listdir(path)) | 58 for filename in os.listdir(path)) |
59 else: | 59 else: |
60 versions = None | 60 versions = None |
61 return self.StatInfo(os.stat(path).st_mtime, versions) | 61 return file_system.StatInfo(os.stat(path).st_mtime, versions) |
62 | 62 |
63 def Stat(self, path): | 63 def Stat(self, path): |
64 try: | 64 try: |
65 return self._CreateStatInfo(os.path.join(self._base_path, path)) | 65 return self._CreateStatInfo(os.path.join(self._base_path, path)) |
66 except OSError: | 66 except OSError: |
67 raise file_system.FileNotFoundError(path) | 67 raise file_system.FileNotFoundError(path) |
OLD | NEW |