comparison servlet/src/digilib/io/FileOps.java @ 246:aaf6eace011d

Servlet version 1.19b4 - bug fixes - new stuff in DocumentBean
author robcast
date Wed, 04 Aug 2004 20:42:48 +0200
parents f8c82fea551a
children beed92ee6022
comparison
equal deleted inserted replaced
245:e93a1d525df2 246:aaf6eace011d
176 return fn.substring(i + 1); 176 return fn.substring(i + 1);
177 } 177 }
178 return ""; 178 return "";
179 } 179 }
180 180
181 /**
182 * Extract the parent directory of a (digilib) path name.
183 *
184 * Returns the parent directory of a path name. The parent is the part before
185 * the last slash in the path name. If the path name has no slash the empty
186 * string is returned.
187 *
188 * @param fn
189 * @return
190 */
191 public static String parent(String fn) {
192 int i = fn.lastIndexOf('/');
193 if (i > 0) {
194 return fn.substring(0, i);
195 }
196 return "";
197 }
198
181 /** Normalize a path name. 199 /** Normalize a path name.
182 * 200 *
183 * Removes leading and trailing slashes. Returns null if there is other 201 * Removes leading and trailing slashes. Returns null if there is other
184 * unwanted stuff in the path name. 202 * unwanted stuff in the path name.
185 * 203 *