@catmint-fs/core 0.0.0-prealpha.2 → 0.0.0-prealpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +9 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -461,7 +461,11 @@ var Layer = class {
|
|
|
461
461
|
*/
|
|
462
462
|
resolvePath(p) {
|
|
463
463
|
const base = this.root.endsWith("/") ? this.root.slice(0, -1) : this.root;
|
|
464
|
-
|
|
464
|
+
let virtual = p.startsWith("/") ? p : "/" + p;
|
|
465
|
+
if (virtual.length > 1 && virtual.endsWith("/")) {
|
|
466
|
+
virtual = virtual.slice(0, -1);
|
|
467
|
+
}
|
|
468
|
+
virtual = virtual.replace(/\/\/+/g, "/");
|
|
465
469
|
if (virtual === "/") return base || "/";
|
|
466
470
|
return base + virtual;
|
|
467
471
|
}
|
|
@@ -1530,12 +1534,12 @@ var Layer = class {
|
|
|
1530
1534
|
async applyOne(detail) {
|
|
1531
1535
|
switch (detail.type) {
|
|
1532
1536
|
case "create": {
|
|
1537
|
+
const ownerOpts = (d) => d.uid || d.gid ? { uid: d.uid, gid: d.gid } : {};
|
|
1533
1538
|
if (detail.entryType === "directory") {
|
|
1534
1539
|
await this.adapter.mkdir(detail.path, {
|
|
1535
1540
|
recursive: true,
|
|
1536
1541
|
mode: detail.mode,
|
|
1537
|
-
|
|
1538
|
-
gid: detail.gid
|
|
1542
|
+
...ownerOpts(detail)
|
|
1539
1543
|
});
|
|
1540
1544
|
} else {
|
|
1541
1545
|
await this.adapter.writeFile(
|
|
@@ -1543,8 +1547,7 @@ var Layer = class {
|
|
|
1543
1547
|
detail.content,
|
|
1544
1548
|
{
|
|
1545
1549
|
mode: detail.mode,
|
|
1546
|
-
|
|
1547
|
-
gid: detail.gid
|
|
1550
|
+
...ownerOpts(detail)
|
|
1548
1551
|
}
|
|
1549
1552
|
);
|
|
1550
1553
|
}
|
|
@@ -1556,8 +1559,7 @@ var Layer = class {
|
|
|
1556
1559
|
detail.content,
|
|
1557
1560
|
{
|
|
1558
1561
|
mode: detail.mode,
|
|
1559
|
-
uid: detail.uid,
|
|
1560
|
-
gid: detail.gid
|
|
1562
|
+
...detail.uid || detail.gid ? { uid: detail.uid, gid: detail.gid } : {}
|
|
1561
1563
|
}
|
|
1562
1564
|
);
|
|
1563
1565
|
break;
|
package/package.json
CHANGED