diff src/org/tmatesoft/hg/util/Path.java @ 148:1a7a9a20e1f9

Exceptions, javadoc. Initial cancel and progress support
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Wed, 23 Feb 2011 22:36:28 +0100
parents 8248aae33f7d
children 1ec6b327a6ac
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/util/Path.java	Tue Feb 22 15:49:26 2011 +0100
+++ b/src/org/tmatesoft/hg/util/Path.java	Wed Feb 23 22:36:28 2011 +0100
@@ -31,6 +31,17 @@
 		path = p;
 	}
 
+	/**
+	 * Check if this is directory's path. 
+	 * Note, this method doesn't perform any file system operation.
+	 * 
+	 * @return true when this path points to a directory 
+	 */
+	public boolean isDirectory() {
+		// XXX simple logic for now. Later we may decide to have an explicit factory method to create directory paths
+		return path.charAt(path.length() - 1) == '/';
+	}
+
 	public int length() {
 		return path.length();
 	}