String fileName = FileUtils.getRelativePath(baseDir, inFile); - File file = new File(fileName); - + + String name; + String dir; + int lastDirSep = fileName.lastIndexOf("/"); + if (lastDirSep > -1) { + name = fileName.substring(lastDirSep + 1); + dir = fileName.substring(0, lastDirSep); + } else { + name = fileName; + dir = "."; // so a dir+"/"+name would not result in an absolute path + } + if (fileNameParameter != null) { - liaison.addParam(fileNameParameter, inFile.getName()); + liaison.addParam(fileNameParameter, name); } if (fileDirParameter != null) { - liaison.addParam(fileDirParameter, (file.getParent()!=null) ? file.getParent() : "" ); + liaison.addParam(fileDirParameter, dir); } }
FWIW, I prefered the File.getParent()/getName() version. I believe the statement that getParent would use \ as filesep to find the parent to be incorrect. getParent is both more explicit and shorter. But maybe I'm missing something about getParent()? Thanks, --DD --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]