Allow "-" in package names + fix bug scanning root folder

This commit is contained in:
Grahame Grieve 2020-03-02 09:02:02 +11:00
parent bc9ad8d608
commit 7f4a0f60fc
1 changed files with 2 additions and 2 deletions

View File

@ -77,7 +77,7 @@ import com.google.gson.JsonObject;
public class NpmPackage { public class NpmPackage {
public static boolean isValidName(String pid) { public static boolean isValidName(String pid) {
return pid.matches("^[a-z][a-zA-Z0-9]*(\\.[a-z][a-zA-Z0-9]*)+$"); return pid.matches("^[a-z][a-zA-Z0-9]*(\\.[a-z][a-zA-Z0-9\\-]*)+$");
} }
public static boolean isValidVersion(String ver) { public static boolean isValidVersion(String ver) {
@ -826,7 +826,7 @@ public class NpmPackage {
public void loadAllFiles() throws IOException { public void loadAllFiles() throws IOException {
for (String folder : folders.keySet()) { for (String folder : folders.keySet()) {
NpmPackageFolder pf = folders.get(folder); NpmPackageFolder pf = folders.get(folder);
String p = Utilities.path(path, folder); String p = folder.contains("$") ? path : Utilities.path(path, folder);
for (File f : new File(p).listFiles()) { for (File f : new File(p).listFiles()) {
if (!f.isDirectory()) { if (!f.isDirectory()) {
pf.getContent().put(f.getName(), TextFile.fileToBytes(f)); pf.getContent().put(f.getName(), TextFile.fileToBytes(f));