Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / chrome / common / extensions / docs / server2 / compiled_file_system.py
index ee86e61..fc4b1fd 100644 (file)
@@ -8,6 +8,7 @@ import schema_util
 from docs_server_utils import ToUnicode
 from file_system import FileNotFoundError
 from future import Gettable, Future
+from path_util import AssertIsDirectory, AssertIsFile
 from third_party.handlebar import Handlebar
 from third_party.json_schema_compiler import json_parse
 from third_party.json_schema_compiler.memoize import memoize
@@ -205,6 +206,8 @@ class CompiledFileSystem(object):
     apply for the first time the file is fetched; if already cached, |binary|
     will be ignored.
     '''
+    AssertIsFile(path)
+
     try:
       version = self._file_system.Stat(path).version
     except FileNotFoundError:
@@ -225,8 +228,7 @@ class CompiledFileSystem(object):
     '''Calls |compilation_function| on the listing of the files at |path|.
     Assumes that the path given is to a directory.
     '''
-    if not path.endswith('/'):
-      path += '/'
+    AssertIsDirectory(path)
 
     try:
       version = self._file_system.Stat(path).version