# HG changeset patch # User wenzelm # Date 1245932354 -7200 # Node ID bc923168c880608cff152b51bc708d81180a9aee # Parent 5e61055bf35b7f429148cd554e3c66773bb3b58d _canonPath: expand_path; _listFiles: robust handling of null; diff -r 5e61055bf35b -r bc923168c880 src/Tools/jEdit/src/jedit/VFS.scala --- a/src/Tools/jEdit/src/jedit/VFS.scala Thu Jun 25 13:36:05 2009 +0200 +++ b/src/Tools/jEdit/src/jedit/VFS.scala Thu Jun 25 14:19:14 2009 +0200 @@ -88,12 +88,18 @@ private def map_file(path: String, file: VFSFile): VFSFile = if (file == null) null else new VFS.File(this, path, file) + private def drop_prefix(path: String): String = + if (path.startsWith(Isabelle.VFS_PREFIX)) + path.substring(Isabelle.VFS_PREFIX.length) + else path + + private def expand_path(path: String): String = + Isabelle.VFS_PREFIX + Isabelle.system.expand_path(drop_prefix(path)) + private def platform_path(path: String): String = - Isabelle.system.platform_path( - if (path.startsWith(Isabelle.VFS_PREFIX)) - path.substring(Isabelle.VFS_PREFIX.length) - else path) + Isabelle.system.platform_path(drop_prefix(path)) + override def getCapabilities = base.getCapabilities override def getExtendedAttributes = base.getExtendedAttributes @@ -116,11 +122,11 @@ override def createVFSSession(path: String, comp: Component) = base.createVFSSession(path, comp) - override def _canonPath(session: Object, path: String, comp: Component) = path // FIXME expand? + override def _canonPath(session: Object, path: String, comp: Component) = expand_path(path) override def _listFiles(session: Object, path: String, comp: Component): Array[VFSFile] = base._listFiles(session, platform_path(path), comp).map(file => - map_file(constructPath(path, file.getName), file)) + if (file == null) null else map_file(constructPath(path, file.getName), file)) override def _getFile(session: Object, path: String, comp: Component) = map_file(path, base._getFile(session, platform_path(path), comp))