public LessStrSource(final String content, final String name) { super(content, name); this.path = spath(FilenameUtils.getPathNoEndSeparator(name)); }
@Test public void testGetPathNoEndSeparator_with_null_byte() { try { assertEquals("a/b", FilenameUtils.getPathNoEndSeparator("~user/a\u0000/b/c.txt")); } catch (final IllegalArgumentException ignore) { } }
assertEquals(null, FilenameUtils.getPath(null)); assertEquals("", FilenameUtils.getPath("noseperator.inthispath")); assertEquals("", FilenameUtils.getPathNoEndSeparator("/noseperator.inthispath")); assertEquals("", FilenameUtils.getPathNoEndSeparator("\\noseperator.inthispath")); assertEquals("a/b", FilenameUtils.getPathNoEndSeparator("a/b/c.txt")); assertEquals("a/b", FilenameUtils.getPathNoEndSeparator("a/b/c")); assertEquals("a/b/c", FilenameUtils.getPathNoEndSeparator("a/b/c/")); assertEquals("a\\b", FilenameUtils.getPathNoEndSeparator("a\\b\\c")); assertEquals(null, FilenameUtils.getPathNoEndSeparator(":")); assertEquals(null, FilenameUtils.getPathNoEndSeparator("1:/a/b/c.txt")); assertEquals(null, FilenameUtils.getPathNoEndSeparator("1:")); assertEquals(null, FilenameUtils.getPathNoEndSeparator("1:a")); assertEquals(null, FilenameUtils.getPathNoEndSeparator("///a/b/c.txt")); assertEquals(null, FilenameUtils.getPathNoEndSeparator("//a")); assertEquals("", FilenameUtils.getPathNoEndSeparator("")); assertEquals("", FilenameUtils.getPathNoEndSeparator("C:")); assertEquals("", FilenameUtils.getPathNoEndSeparator("C:/")); assertEquals("", FilenameUtils.getPathNoEndSeparator("//server/")); assertEquals("", FilenameUtils.getPathNoEndSeparator("~")); assertEquals("", FilenameUtils.getPathNoEndSeparator("~/")); assertEquals("", FilenameUtils.getPathNoEndSeparator("~user")); assertEquals("", FilenameUtils.getPathNoEndSeparator("~user/")); assertEquals("a/b", FilenameUtils.getPathNoEndSeparator("a/b/c.txt")); assertEquals("a/b", FilenameUtils.getPathNoEndSeparator("/a/b/c.txt")); assertEquals("", FilenameUtils.getPathNoEndSeparator("C:a")); assertEquals("a/b", FilenameUtils.getPathNoEndSeparator("C:a/b/c.txt"));
private static File getAlternativeFile(String path, boolean removeExtension) { String basePath = FilenameUtils.getPathNoEndSeparator(path); String name = removeExtension ? FilenameUtils.getBaseName(path) : FilenameUtils.getName(path); String alternativePath = basePath + File.separatorChar + name; return new File(FOOTPRINTS_DATA_DIR, alternativePath); }
public SchedulerOutputPathResolver( final String outputPathPattern, final String actionUser ) { this.jobName = FilenameUtils.getBaseName( outputPathPattern ); this.outputDirectory = FilenameUtils.getPathNoEndSeparator( outputPathPattern ); this.actionUser = actionUser; }
/** * Gets the path from a full filename, which excludes the prefix, and also excluding the final directory separator. * <p/> * The method is entirely text based, and returns the text before the last forward or backslash. * * <pre> * a.txt --> "" * a/b/c --> a/b * a/b/c/ --> a/b/c * /a.txt --> "" * /a/b/c --> a/b * /a/b/c/ --> a/b/c * </pre> * <p/> * This method drops the prefix from the result. See {@link #getFullPathNoEndSeparator(String)} for the method that * retains the prefix. * * @param filename * the filename to query, null returns null * @return the path of the file, an empty string if none exists, null if invalid */ public static String getPathNoEndSeparator( final String filename ) { return FilenameUtils.getPathNoEndSeparator( filename ); }
/** * Generates a URI prefix for a file private namespace in the specified * {@link ASFileScope}. * * @param baseName The basename of the private namespace * @param fileScope The {@link ASFileScope} which contains the file * private namespace for which a URI prefix is to be generated. * @return The URI prefix for the file private namespace of the * specified {@link ASFileScope}. * @see #generateURI(INamespaceReference, IASScope, String) */ private static String generateQualifierPrefixStringForFilePrivate(String baseName, ASFileScope fileScope) { String sourcePath = fileScope.getContainingPath(); String dirName = FilenameUtils.getPathNoEndSeparator(sourcePath); String md5String = StringEncoder.stringToMD5String(dirName); return FilenameUtils.getName(baseName) + "$" + md5String; }
/** * Generates a URI prefix for a file private namespace in the specified * {@link ASFileScope}. * * @param baseName The basename of the private namespace * @param fileScope The {@link ASFileScope} which contains the file * private namespace for which a URI prefix is to be generated. * @return The URI prefix for the file private namespace of the * specified {@link ASFileScope}. * @see #generateURI(INamespaceReference, IASScope, String) */ private static String generateQualifierPrefixStringForFilePrivate(String baseName, ASFileScope fileScope) { String sourcePath = fileScope.getContainingPath(); String dirName = FilenameUtils.getPathNoEndSeparator(sourcePath); String md5String = StringEncoder.stringToMD5String(dirName); return FilenameUtils.getName(baseName) + "$" + md5String; }
JarFile jarFile = conn.getJarFile(); String pomEntryName = conn.getEntryName(); String pomParentDir = FilenameUtils.getPathNoEndSeparator(pomEntryName) + "/"; Predicate<? super JarEntry> filter = entry -> { return entry.getName().startsWith(pomParentDir);
/** * Generates a URI prefix for a file private namespace in the specified * {@link ASFileScope}. * * @param baseName The basename of the private namespace * @param fileScope The {@link ASFileScope} which contains the file * private namespace for which a URI prefix is to be generated. * @return The URI prefix for the file private namespace of the * specified {@link ASFileScope}. * @see #generateURI(INamespaceReference, IASScope, String) */ private static String generateQualifierPrefixStringForFilePrivate(String baseName, ASFileScope fileScope) { String sourcePath = fileScope.getContainingPath(); String dirName = FilenameUtils.getPathNoEndSeparator(sourcePath); String md5String = StringEncoder.stringToMD5String(dirName); return FilenameUtils.getName(baseName) + "$" + md5String; }
FilenameUtils.getPathNoEndSeparator(path) + "/" + FilenameUtils.getBaseName(path);
ZipOutputStream out = null; try { String destDir = FilenameUtils.getPathNoEndSeparator(destination.toString()); Path f = Paths.get(destDir); if(Files.notExists(f)) {
String relativeParentPath = FilenameUtils.getPathNoEndSeparator(relativePath); itemPathBuilder.append(relativeParentPath); addedRelativeParent = true;
FilenameUtils.getPathNoEndSeparator(entryName)); if(targetFolder.exists() || targetFolder.mkdirs()){ File outFile = new File(targetFolder,
FilenameUtils.getPathNoEndSeparator(entryName)); if(targetFolder.exists() || targetFolder.mkdirs()){ File outFile = new File(targetFolder,
String typeName = FilenameUtils.getBaseName(FilenameUtils.getPathNoEndSeparator(this.parentLocation));
final String base = golang.getPackageName(); for (final String file : scanner.getIncludedFiles()) { final String path = FilenameUtils.getPathNoEndSeparator(file).replace(File.separatorChar, '/'); if (isNotEmpty(path)) { result.add(base + "/" + path);
inputBasename="/"+inputBasename; if (FilenameUtils.getPathNoEndSeparator(filename).equals("")){ inputBasename="./"+inputBasename;
final String base = golang.getPackageName(); for (final String file : scanner.getIncludedFiles()) { final String path = FilenameUtils.getPathNoEndSeparator(file).replace(File.separatorChar, '/'); final String packageName = isNotEmpty(path) ? base + "/" + path : base; for (final Path gopath : build.getGopathSourceRoot()) {