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

Unified Diff: chrome/common/extensions/docs/server2/path_util.py

Issue 344453003: Docserver: separate models for apps and extensions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/docs/server2/path_util.py
diff --git a/chrome/common/extensions/docs/server2/path_util.py b/chrome/common/extensions/docs/server2/path_util.py
index fa9db48553dc82f86a333aa9171b48fb88dd8d66..aa644672b5ac36aab8e6288910c7ae7f7c0608f2 100644
--- a/chrome/common/extensions/docs/server2/path_util.py
+++ b/chrome/common/extensions/docs/server2/path_util.py
@@ -45,6 +45,17 @@ def SplitParent(path):
return parent, base
+def Split(path):
+ '''Returns a list of the directories and filename in a path. 'p1/p2/p3'
+ will return ['p1/', 'p2/', 'p3'].
+ '''
+ AssertIsValid(path)
+ names = [name + '/' for name in path.rstrip('/').split('/')]
+ if names and not path.endswith('/'):
+ names[-1] = names[-1][:-1]
+ return names
+
+
def ToDirectory(path):
'''Returns a string representing |path| as a directory, that is,
IsDirectory(result) is True (and does not fail assertions). If |path| is

Powered by Google App Engine
This is Rietveld 408576698