MCPcopy Create free account
hub / github.com/SquirrelJME/SquirrelJME / __zipName

Method __zipName

NewBootstrap.java:754–778  ·  view source on GitHub ↗

Calculates the name that a file would appear as inside of a ZIP file. @param __root The root path. @param __p The file to add. @return The ZIP compatible name. @throws NullPointerException On null arguments. @since 2016/03/21

(Path __root, Path __p)

Source from the content-addressed store, hash-verified

752 * @since 2016/03/21
753 */
754 private static String __zipName(Path __root, Path __p)
755 throws NullPointerException
756 {
757 // Check
758 if (__root == null || __p == null)
759 throw new NullPointerException();
760
761 // Calculate relative name
762 Path rel = __root.toAbsolutePath().relativize(__p.toAbsolutePath());
763
764 // Build name
765 StringBuilder sb = new StringBuilder();
766 for (Path comp : rel)
767 {
768 // Prefix slash
769 if (sb.length() > 0)
770 sb.append('/');
771
772 // Add component
773 sb.append(comp);
774 }
775
776 // Return it
777 return sb.toString();
778 }
779
780 /**
781 * This represents a single project which may be built.

Callers 1

acceptMethod · 0.80

Calls 5

lengthMethod · 0.95
appendMethod · 0.95
toStringMethod · 0.95
relativizeMethod · 0.80
toAbsolutePathMethod · 0.80

Tested by

no test coverage detected