private String getFullPathWithName( String filename ) { return FilenameUtils.getFullPath( filename ) + FilenameUtils.getName( filename ); }
@Override public boolean isIgnored(Path path) { if (!isInit) { throw new IllegalStateException("Called init() first"); } String fullPath = FilenameUtils.getFullPath(path.toAbsolutePath().toString()); File scmIgnoreFile = new File(fullPath, path.getFileName() + IGNORE_FILE_EXTENSION); return scmIgnoreFile.exists(); }
public static Result run(String inPaths, String pkgName) throws IOException, ClassHierarchyException, IllegalArgumentException { String outPath = ""; String firstInPath = inPaths.split(",")[0]; if (firstInPath.endsWith(".jar") || firstInPath.endsWith(".aar")) { outPath = FilenameUtils.getFullPath(firstInPath) + FilenameUtils.getBaseName(firstInPath) + MODEL_JAR_SUFFIX; } else if (new File(firstInPath).exists()) { outPath = FilenameUtils.getFullPath(firstInPath) + DEFAULT_ASTUBX_LOCATION; } return run(inPaths, pkgName, outPath, DEBUG, VERBOSE); } /**
/** * Startup the watchdir service. */ private void startupWatchdir() throws Exception { File dirToWatch; if (this.configuration.getProcessConfigDirOrFile().isFile()) { dirToWatch = new File(FilenameUtils.getFullPath(this.configuration.getProcessConfigDirOrFile().getAbsolutePath())); } else { dirToWatch = this.configuration.getProcessConfigDirOrFile(); } // start the watcher this.watcher = new WatchDir(dirToWatch, this); this.watcher.start(); }
@Test public void testGetFullPath() { assertEquals(null, FilenameUtils.getFullPath(null)); assertEquals("", FilenameUtils.getFullPath("noseperator.inthispath")); assertEquals("a/b/", FilenameUtils.getFullPath("a/b/c.txt")); assertEquals("a/b/", FilenameUtils.getFullPath("a/b/c")); assertEquals("a/b/c/", FilenameUtils.getFullPath("a/b/c/")); assertEquals("a\\b\\", FilenameUtils.getFullPath("a\\b\\c")); assertEquals(null, FilenameUtils.getFullPath(":")); assertEquals(null, FilenameUtils.getFullPath("1:/a/b/c.txt")); assertEquals(null, FilenameUtils.getFullPath("1:")); assertEquals(null, FilenameUtils.getFullPath("1:a")); assertEquals(null, FilenameUtils.getFullPath("///a/b/c.txt")); assertEquals(null, FilenameUtils.getFullPath("//a")); assertEquals("", FilenameUtils.getFullPath("")); assertEquals("C:", FilenameUtils.getFullPath("C:")); assertEquals("C:/", FilenameUtils.getFullPath("C:/")); assertEquals("//server/", FilenameUtils.getFullPath("//server/")); assertEquals("~/", FilenameUtils.getFullPath("~")); assertEquals("~/", FilenameUtils.getFullPath("~/")); assertEquals("~user/", FilenameUtils.getFullPath("~user")); assertEquals("~user/", FilenameUtils.getFullPath("~user/")); assertEquals("a/b/", FilenameUtils.getFullPath("a/b/c.txt")); assertEquals("/a/b/", FilenameUtils.getFullPath("/a/b/c.txt")); assertEquals("C:", FilenameUtils.getFullPath("C:a")); assertEquals("C:a/b/", FilenameUtils.getFullPath("C:a/b/c.txt")); assertEquals("C:/a/b/", FilenameUtils.getFullPath("C:/a/b/c.txt"));
private void compareSnapshotFiles( Set<String> firstSnapshotFileNames, Set<String> secondSnapshotFileNames, FileSystemAbstraction fileSystem ) { assertThat( format( "Should have %d modified index segment files. Snapshot segment files are: %s", NUMBER_OF_INDEXES, firstSnapshotFileNames ), firstSnapshotFileNames, hasSize( NUMBER_OF_INDEXES ) ); for ( String fileName : firstSnapshotFileNames ) { assertFalse( "Snapshot segments fileset should not have files from another snapshot set." + describeFileSets( firstSnapshotFileNames, secondSnapshotFileNames ), secondSnapshotFileNames.contains( fileName ) ); String path = FilenameUtils.getFullPath( fileName ); assertTrue( "Snapshot should contain files for index in path: " + path + "." + describeFileSets( firstSnapshotFileNames, secondSnapshotFileNames ), secondSnapshotFileNames.stream().anyMatch( name -> name.startsWith( path ) ) ); assertTrue( format( "Snapshot segment file '%s' should exist.", fileName ), fileSystem.fileExists( new File( fileName ) ) ); } }
File parentDir = new File( FilenameUtils.getFullPath( parsedDestination ) ); if ( ! parentDir.exists() )
private String getBaseFullName(String path) { final String baseName = FilenameUtils.getBaseName(path); final String fullPath = FilenameUtils.getFullPath(path); return fullPath + File.separatorChar + baseName; }
/** * Return supportFiles (if found) for the specified file * * @param filePath * @return */ public List<File> getSupportFiles(String filePath) { List<File> supportFiles = null; String parent = FilenameUtils.getFullPath(filePath); String mainName = FilenameUtils.getName(filePath); String baseName = FilenameUtils.removeExtension(mainName); for (String extension : supportingExtensions) { String newFilePath = parent + baseName + extension; File file = new File(newFilePath); if (file.exists()) { if (supportFiles == null) { supportFiles = new ArrayList<File>(); } supportFiles.add(file); } } return supportFiles; } }
/** * Creates a human readable message that describe the provided {@link File} object in terms of * its properties. * * <p>Useful for creating meaningful log messages. * * @param file the {@link File} object to create a descriptive message for * @return a {@link String} containing a descriptive message about the provided {@link File}. */ public static String getFileInfo(final File file) { final StringBuilder builder = new StringBuilder(); builder.append("Checking file:") .append(FilenameUtils.getFullPath(file.getAbsolutePath())) .append("\n"); builder.append("isHidden:").append(file.isHidden()).append("\n"); builder.append("exists:").append(file.exists()).append("\n"); builder.append("isFile").append(file.isFile()).append("\n"); builder.append("canRead:").append(file.canRead()).append("\n"); builder.append("canWrite").append(file.canWrite()).append("\n"); builder.append("canExecute:").append(file.canExecute()).append("\n"); builder.append("isAbsolute:").append(file.isAbsolute()).append("\n"); builder.append("lastModified:").append(file.lastModified()).append("\n"); builder.append("length:").append(file.length()); final String message = builder.toString(); return message; }
/** * Prepares a message with the status of the provided file. * * @param sourceFile The {@link File} to provided the status message for * @return a status message for the provided {@link File} or a {@link NullPointerException} in * case the {@link File}is <code>null</code>. */ private static String fileStatus(File sourceFile) { if (sourceFile == null) { throw new NullPointerException("Provided null input to fileStatus method"); } final StringBuilder builder = new StringBuilder(); builder.append("Checking file: ") .append(FilenameUtils.getFullPath(sourceFile.getAbsolutePath())) .append("\n"); builder.append("exists: ").append(sourceFile.exists()).append("\n"); builder.append("isFile: ").append(sourceFile.isFile()).append("\n"); builder.append("canRead: ").append(sourceFile.canRead()).append("\n"); builder.append("canWrite: ").append(sourceFile.canWrite()).append("\n"); builder.append("canExecute: ").append(sourceFile.canExecute()).append("\n"); builder.append("isHidden: ").append(sourceFile.isHidden()).append("\n"); builder.append("lastModified: ").append(sourceFile.lastModified()).append("\n"); return builder.toString(); }
/** * Creates a human readable message that describe the provided {@link File} object in terms of * its properties. * * <p> * * <p>Useful for creating meaningful log messages. * * @param file the {@link File} object to create a descriptive message for * @return a {@link String} containing a descriptive message about the provided {@link File}. */ public static String getFileInfo(final File file) { final StringBuilder builder = new StringBuilder(); builder.append("Checking file:") .append(FilenameUtils.getFullPath(file.getAbsolutePath())) .append("\n"); builder.append("isHidden:").append(file.isHidden()).append("\n"); builder.append("exists:").append(file.exists()).append("\n"); builder.append("isFile").append(file.isFile()).append("\n"); builder.append("canRead:").append(file.canRead()).append("\n"); builder.append("canWrite").append(file.canWrite()).append("\n"); builder.append("canExecute:").append(file.canExecute()).append("\n"); builder.append("isAbsolute:").append(file.isAbsolute()).append("\n"); builder.append("lastModified:").append(file.lastModified()).append("\n"); builder.append("length:").append(file.length()); final String message = builder.toString(); return message; }
/** * Devuelve el path de un archivo ejemplo c:/carpeta1/subcarpeta1/archivo.txt * retorna c:/carpeta1/subcarpeta1/ * @param file nombre y path del archivo * @return el path del archivo */ public static String getFullPath(String file){ return FilenameUtils.getFullPath(file); }
public static String getMuleAppConfiguration(String muleConfig) { String directory = getFullPath(muleConfig); String muleAppConfiguration = directory + DEFAULT_CONFIGURATION_RESOURCE; return muleAppConfiguration; }
this.tileIndexStore = new PostgisDatastoreWrapper( getTileIndexStore(), FilenameUtils.getFullPath(parentLocation)); } else if (Utils.isOracleStore(spi)) { this.tileIndexStore = new OracleDatastoreWrapper( getTileIndexStore(), FilenameUtils.getFullPath(parentLocation));
/** * Similar to {@link FilenameUtils#getFullPath(String)}, but fixes the problem with Windows platform for situations * when the path starts with "/" (servlet context relative resources) which are resolved to "\" on windows. * * @param path * to compute filePath from. * @return full path from the provided path. */ public static final String getFullPath(final String path) { final String fullPath = FilenameUtils.getFullPath(path); return replaceWithServletContextSeparatorIfNedded(fullPath); }
/** * Similar to {@link FilenameUtils#getFullPath(String)}, but fixes the problem with Windows platform for situations * when the path starts with "/" (servlet context relative resources) which are resolved to "\" on windows. * * @param path * to compute filePath from. * @return full path from the provided path. */ public static final String getFullPath(final String path) { final String fullPath = FilenameUtils.getFullPath(path); return replaceWithServletContextSeparatorIfNedded(fullPath); }
@Nullable protected String getLocalizedTemplateContent(Resources resources, String defaultTemplateName, String locale) { String localizedTemplate = FilenameUtils.getFullPath(defaultTemplateName) + FilenameUtils.getBaseName(defaultTemplateName) + "_" + locale + "." + FilenameUtils.getExtension(defaultTemplateName); return resources.getResourceAsString(localizedTemplate); }
public String getArchiveLocation(String pathToTest) { String pathToArchive = FilenameUtils.concat(pathToTest, FilenameUtils .getFullPath(fArchive)); String archiveName = FilenameUtils.getName(fArchive); return FilenameUtils.concat(pathToArchive, archiveName); }
final String path = FilenameUtils.getFullPath(canonicalPath); final String baseName = FilenameUtils.getBaseName(canonicalPath); final String histogramPath = path + baseName + "." + "histogram";