-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
690 additions
and
330 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package net.neoforged.jst.api; | ||
|
||
import java.nio.file.Path; | ||
import java.util.zip.ZipEntry; | ||
import java.util.zip.ZipFile; | ||
|
||
public final class FileEntries { | ||
private FileEntries() { | ||
} | ||
|
||
/** | ||
* Creates a file entry for a given NIO path. | ||
* Since file entries need to know their path relative to the source root, the source root has to be | ||
* given as an additional parameter. | ||
*/ | ||
public static FileEntry ofPath(Path sourceRoot, Path path) { | ||
if (path.equals(sourceRoot)) { | ||
throw new IllegalStateException("path must not be the source root itself, since this results in an empty relative path"); | ||
} | ||
if (!path.startsWith(sourceRoot)) { | ||
throw new IllegalStateException("path must be a child of sourceRoot"); | ||
} | ||
return new PathFileEntry(sourceRoot, path); | ||
} | ||
|
||
/** | ||
* Creates a file entry for an existing zip entry. Will source the content from the given zip file. | ||
*/ | ||
public static FileEntry ofZipEntry(ZipFile zipFile, ZipEntry zipEntry) { | ||
return new ZipFileEntry(zipFile, zipEntry); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
|
||
public enum PathType { | ||
AUTO, | ||
SINGLE_FILE, | ||
FILE, | ||
ARCHIVE, | ||
FOLDER | ||
} |
Oops, something went wrong.