fix bug in NpmPackage
This commit is contained in:
parent
f718764d6e
commit
8b0266e23b
|
@ -185,7 +185,6 @@ public class NpmPackage {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void loadFiles(NpmPackage res, String path, File source, String... exemptions) throws FileNotFoundException, IOException {
|
public static void loadFiles(NpmPackage res, String path, File source, String... exemptions) throws FileNotFoundException, IOException {
|
||||||
System.out.println("Load Package from "+path);
|
|
||||||
res.npm = (JsonObject) new com.google.gson.JsonParser().parse(TextFile.fileToString(Utilities.path(path, "package", "package.json")));
|
res.npm = (JsonObject) new com.google.gson.JsonParser().parse(TextFile.fileToString(Utilities.path(path, "package", "package.json")));
|
||||||
|
|
||||||
File dir = new File(path);
|
File dir = new File(path);
|
||||||
|
@ -195,7 +194,6 @@ public class NpmPackage {
|
||||||
if (!d.equals("package")) {
|
if (!d.equals("package")) {
|
||||||
d = Utilities.path("package", d);
|
d = Utilities.path("package", d);
|
||||||
}
|
}
|
||||||
System.out.println(" see "+f.getAbsolutePath()+" as "+d);
|
|
||||||
NpmPackageFolder folder = res.new NpmPackageFolder(d);
|
NpmPackageFolder folder = res.new NpmPackageFolder(d);
|
||||||
folder.folder = f;
|
folder.folder = f;
|
||||||
res.folders.put(f.getName(), folder);
|
res.folders.put(f.getName(), folder);
|
||||||
|
@ -219,7 +217,6 @@ public class NpmPackage {
|
||||||
if (!d.startsWith("package")) {
|
if (!d.startsWith("package")) {
|
||||||
d = Utilities.path("package", d);
|
d = Utilities.path("package", d);
|
||||||
}
|
}
|
||||||
System.out.println(" see "+f.getAbsolutePath()+" as "+d);
|
|
||||||
NpmPackageFolder folder = res.new NpmPackageFolder(d);
|
NpmPackageFolder folder = res.new NpmPackageFolder(d);
|
||||||
folder.folder = f;
|
folder.folder = f;
|
||||||
res.folders.put(d, folder);
|
res.folders.put(d, folder);
|
||||||
|
@ -715,7 +712,7 @@ public class NpmPackage {
|
||||||
public void unPack(String dir, boolean withAppend) throws IOException {
|
public void unPack(String dir, boolean withAppend) throws IOException {
|
||||||
for (NpmPackageFolder folder : folders.values()) {
|
for (NpmPackageFolder folder : folders.values()) {
|
||||||
String dn = folder.getName();
|
String dn = folder.getName();
|
||||||
if (!dn.equals("package")) {
|
if (!dn.equals("package") && dn.startsWith("package/")) {
|
||||||
dn = dn.substring(8);
|
dn = dn.substring(8);
|
||||||
}
|
}
|
||||||
if (dn.equals("$root")) {
|
if (dn.equals("$root")) {
|
||||||
|
@ -728,7 +725,7 @@ public class NpmPackage {
|
||||||
String fn = Utilities.path(dn, s);
|
String fn = Utilities.path(dn, s);
|
||||||
File f = new File(fn);
|
File f = new File(fn);
|
||||||
if (withAppend && f.getName().startsWith("_append.")) {
|
if (withAppend && f.getName().startsWith("_append.")) {
|
||||||
String appendFn = Utilities.path(dir, Utilities.getDirectoryForFile(s), f.getName().substring(8));
|
String appendFn = Utilities.path(dn, s.substring(8));
|
||||||
if (new File(appendFn).exists())
|
if (new File(appendFn).exists())
|
||||||
TextFile.appendBytesToFile(folder.fetchFile(s), appendFn);
|
TextFile.appendBytesToFile(folder.fetchFile(s), appendFn);
|
||||||
else
|
else
|
||||||
|
@ -742,13 +739,13 @@ public class NpmPackage {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void debugDump(String purpose) {
|
public void debugDump(String purpose) {
|
||||||
System.out.println("Debug Dump of Package for '"+purpose+"'. Path = "+path);
|
// System.out.println("Debug Dump of Package for '"+purpose+"'. Path = "+path);
|
||||||
System.out.println(" npm = "+name()+"#"+version()+", canonical = "+canonical());
|
// System.out.println(" npm = "+name()+"#"+version()+", canonical = "+canonical());
|
||||||
System.out.println(" folders = "+folders.size());
|
// System.out.println(" folders = "+folders.size());
|
||||||
for (String s : sorted(folders.keySet())) {
|
// for (String s : sorted(folders.keySet())) {
|
||||||
NpmPackageFolder folder = folders.get(s);
|
// NpmPackageFolder folder = folders.get(s);
|
||||||
System.out.println(" "+folder.dump());
|
// System.out.println(" "+folder.dump());
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<String> sorted(Set<String> keys) {
|
private List<String> sorted(Set<String> keys) {
|
||||||
|
|
Loading…
Reference in New Issue