Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(328)

Side by Side Diff: chrome/common/extensions/docs/server2/local_file_system.py

Issue 264793013: Fixing Extensions Integration Test LocalFileSystem path issues under Windows (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 import sys 6 import sys
7 7
8 from docs_server_utils import StringIdentity 8 from docs_server_utils import StringIdentity
9 from file_system import FileSystem, FileNotFoundError, StatInfo 9 from file_system import FileSystem, FileNotFoundError, StatInfo
10 from future import Future 10 from future import Future
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 return StatInfo(version, child_versions) 62 return StatInfo(version, child_versions)
63 except OSError as e: 63 except OSError as e:
64 raise FileNotFoundError('os.stat failed for %s: %s' % (path, e)) 64 raise FileNotFoundError('os.stat failed for %s: %s' % (path, e))
65 65
66 66
67 class LocalFileSystem(FileSystem): 67 class LocalFileSystem(FileSystem):
68 '''FileSystem implementation which fetches resources from the local 68 '''FileSystem implementation which fetches resources from the local
69 filesystem. 69 filesystem.
70 ''' 70 '''
71 def __init__(self, base_path): 71 def __init__(self, base_path):
72 base_path = base_path.replace('\\', '/') # Convert to POSIX path.
not at google - send to devlin 2014/05/02 19:23:41 os.path would be more idiomatic. comment not very
huangs 2014/05/02 21:07:01 os.path.split() is not the inverse of os.path.join
not at google - send to devlin 2014/05/02 21:07:41 bleh, I meant os.sep not os.path.
72 AssertIsDirectory(base_path) 73 AssertIsDirectory(base_path)
73 self._base_path = _ConvertToFilepath(base_path) 74 self._base_path = _ConvertToFilepath(base_path)
74 75
75 @staticmethod 76 @staticmethod
76 def Create(*path): 77 def Create(*path):
77 return LocalFileSystem(ChromiumPath(*path)) 78 return LocalFileSystem(ChromiumPath(*path))
78 79
79 def Read(self, paths, skip_not_found=False): 80 def Read(self, paths, skip_not_found=False):
80 def resolve(): 81 def resolve():
81 result = {} 82 result = {}
(...skipping 15 matching lines...) Expand all
97 AssertIsValid(path) 98 AssertIsValid(path)
98 full_path = os.path.join(self._base_path, 99 full_path = os.path.join(self._base_path,
99 _ConvertToFilepath(path).lstrip(os.sep)) 100 _ConvertToFilepath(path).lstrip(os.sep))
100 return _CreateStatInfo(full_path) 101 return _CreateStatInfo(full_path)
101 102
102 def GetIdentity(self): 103 def GetIdentity(self):
103 return '@'.join((self.__class__.__name__, StringIdentity(self._base_path))) 104 return '@'.join((self.__class__.__name__, StringIdentity(self._base_path)))
104 105
105 def __repr__(self): 106 def __repr__(self):
106 return 'LocalFileSystem(%s)' % self._base_path 107 return 'LocalFileSystem(%s)' % self._base_path
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698