public class FileUtil
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
URI_SEPARATOR_CHAR |
| Constructor and Description |
|---|
FileUtil() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
asPath(java.io.File file)
platform independent file.getPath()
|
static java.lang.String |
asPath(java.lang.String path)
platform independent file.getPath()
|
static boolean |
directoryOnlyIfNotIgnored(java.io.File file)
Ignores directory (and children) if it contains a file named ".jbakeignore".
|
static java.lang.String |
fileExt(java.io.File src) |
static java.lang.String |
fileExt(java.lang.String name) |
static java.io.FileFilter |
getFileFilter()
Filters files based on their file extension.
|
static java.io.FileFilter |
getNotContentFileFilter()
Gets the list of files that are not content files based on their extension.
|
static java.lang.String |
getPathToRoot(JBakeConfiguration config,
java.io.File rootPath,
java.io.File sourceFile)
Given a file inside content it return
the relative path to get to the root.
|
static java.io.File |
getRunningLocation()
Works out the folder where JBake is running from.
|
static java.lang.String |
getUriPathToContentRoot(JBakeConfiguration config,
java.io.File sourceFile) |
static java.lang.String |
getUriPathToDestinationRoot(JBakeConfiguration config,
java.io.File sourceFile) |
static boolean |
isExistingFolder(java.io.File f) |
static boolean |
isFileInDirectory(java.io.File file,
java.io.File directory)
Utility method to determine if a given file is located somewhere in the directory provided.
|
static java.lang.String |
sha1(java.io.File sourceFile)
Computes the hash of a file or directory.
|
public static final java.lang.String URI_SEPARATOR_CHAR
public static java.io.FileFilter getFileFilter()
public static java.io.FileFilter getNotContentFileFilter()
public static boolean directoryOnlyIfNotIgnored(java.io.File file)
file - FileBoolean true/falsepublic static boolean isExistingFolder(java.io.File f)
public static java.io.File getRunningLocation()
throws java.lang.Exception
java.lang.Exception - when application is not able to work out where is JBake running frompublic static java.lang.String fileExt(java.io.File src)
public static java.lang.String fileExt(java.lang.String name)
public static java.lang.String sha1(java.io.File sourceFile)
throws java.lang.Exception
sourceFile - the original file or directoryjava.lang.Exception - if any IOException of SecurityException occuredpublic static java.lang.String asPath(java.io.File file)
file - the file to transform, or nullnull
Needed to transform Windows path separators into slashes.public static java.lang.String asPath(java.lang.String path)
path - the path to transform, or nullpublic static java.lang.String getPathToRoot(JBakeConfiguration config, java.io.File rootPath, java.io.File sourceFile)
Example: /content and /content/tags/blog will return '../..'
sourceFile - the file to calculate relative path forpublic static java.lang.String getUriPathToDestinationRoot(JBakeConfiguration config, java.io.File sourceFile)
public static java.lang.String getUriPathToContentRoot(JBakeConfiguration config, java.io.File sourceFile)
public static boolean isFileInDirectory(java.io.File file,
java.io.File directory)
throws java.io.IOException
file - used to check if it is located in the provided directory.directory - to validate whether or not the provided file resides.java.io.IOException - if the canonical path for either of the input directories can't be determined.