Class FileHandling

java.lang.Object
org.ek9lang.core.FileHandling

public final class FileHandling extends Object
Designed to abstract out all file handling for the compiler.
  • Constructor Details

    • FileHandling

      public FileHandling(OsSupport osSupport)
      Create File Handling with the appropriately configured OS support. Quite a few of these methods just delegate to OsSupport and the Packager.
  • Method Details

    • getTempDirectory

      public String getTempDirectory()
    • getUsersHomeDirectory

      public String getUsersHomeDirectory()
    • getUsersHomeEk9LibDirectory

      public File getUsersHomeEk9LibDirectory()
    • getUsersHomeEk9Directory

      public String getUsersHomeEk9Directory()
    • getDotEk9Directory

      public String getDotEk9Directory(File directory)
    • getDotEk9Directory

      public String getDotEk9Directory(String fromDirectory)
    • makePackagedModuleZipFileName

      public String makePackagedModuleZipFileName(String moduleName, String version)
    • makePackagedModuleZipFileName

      public String makePackagedModuleZipFileName(String dependencyVector)
    • makeDependencyVector

      public String makeDependencyVector(String moduleName, String version)
      Create a full dependency vector out of module name and verssion.
    • copy

      public boolean copy(File sourceDir, File destinationDir, String fileName)
      Copy a named file from a source directory to a destination directory.
    • copy

      public boolean copy(File fullSourcePath, File fullDestinationPath)
      Copy a file to a new destination.
    • saveToOutput

      public boolean saveToOutput(File file, String value)
      Save some text to a file.
    • deleteFileIfExists

      public void deleteFileIfExists(File file)
      Deletes a file if it exists or a compiler exception if it cannot be deleted.
    • makeDirectoryIfNotExists

      public void makeDirectoryIfNotExists(File directory)
      Create a directory.
    • deleteMatchingFiles

      public void deleteMatchingFiles(File dir, String fileNamePattern)
      deletes matching files.
      Parameters:
      dir - the directory to look in
      fileNamePattern - The pattern regex not shell so for * use .* for .txt use \\.txt
    • deleteContentsAndBelow

      public void deleteContentsAndBelow(File dir, boolean includeDirectoryRoot)
      Does a recursive delete from this directory and below. If includeDirectoryRoot is true then it will delete that directory as well
    • createSha256Of

      public Digest.CheckSum createSha256Of(String fileName)
      Create a sha256 hash of a file and save it in fileName".sha256"
    • createJar

      public boolean createJar(String fileName, List<ZipSet> sets)
      Create a Java jar file with a list of zip sets.
    • unZipFileTo

      public boolean unZipFileTo(File zipFile, String unpackedDir)
    • unZipFileTo

      public boolean unZipFileTo(File zipFile, File unpackedDir)
      Unzips a zip file into a directory, the directory will be created if it does not exist.
    • createZip

      public boolean createZip(String fileName, ZipSet set, File sourcePropertiesFile)
      To be used for making the zip when publishing ek9 source to artefact server.
      Parameters:
      fileName - The name of the zip to create
      sourcePropertiesFile - The properties file that describes the package.
      Returns:
      true if all OK.
    • getTargetExecutableArtefact

      public File getTargetExecutableArtefact(String ek9FullPathToFileName, String targetArchitecture)
    • getTargetPropertiesArtefact

      public File getTargetPropertiesArtefact(String ek9FullPathToFileName)
    • validateHomeEk9Directory

      public void validateHomeEk9Directory(String targetArchitecture)
    • validateEk9Directory

      public void validateEk9Directory(String directoryName, String targetArchitecture)
    • cleanEk9DirectoryStructureFor

      public void cleanEk9DirectoryStructureFor(File ek9File, String targetArchitecture)
    • cleanEk9DirectoryStructureFor

      public void cleanEk9DirectoryStructureFor(String ek9FullPathToFileName, String targetArchitecture)
    • getMainGeneratedOutputDirectory

      public File getMainGeneratedOutputDirectory(String fromEk9BaseDirectory, String targetArchitecture)
    • getMainFinalOutputDirectory

      public File getMainFinalOutputDirectory(String fromEk9BaseDirectory, String targetArchitecture)
    • getDevGeneratedOutputDirectory

      public File getDevGeneratedOutputDirectory(String fromEk9BaseDirectory, String targetArchitecture)
    • getDevFinalOutputDirectory

      public File getDevFinalOutputDirectory(String fromEk9BaseDirectory, String targetArchitecture)
    • deleteStalePackages

      public void deleteStalePackages(String ek9FileNameDirectory, String moduleName)
    • isUsersSigningKeyPairPresent

      public boolean isUsersSigningKeyPairPresent()
    • getUsersSigningKeyPair

      public SigningKeyPair getUsersSigningKeyPair()
    • saveToHomeEk9Directory

      public boolean saveToHomeEk9Directory(SigningKeyPair keyPair)