cadet-agent 0.20.1 → 0.20.2

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/install.mjs +13 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cadet-agent",
3
- "version": "0.20.1",
3
+ "version": "0.20.2",
4
4
  "description": "Cross-IDE agent framework for Unity/C# game-development — one-command install",
5
5
  "type": "module",
6
6
  "bin": {
package/src/install.mjs CHANGED
@@ -276,15 +276,19 @@ function matchesManagedPath(filename, managedPaths) {
276
276
  }
277
277
 
278
278
  function walkDir(dir, fn) {
279
- const entries = readdirSync(dir, { withFileTypes: true });
280
- for (const entry of entries) {
281
- const fullPath = join(dir, entry.name);
282
- if (entry.isDirectory()) {
283
- walkDir(fullPath, fn);
284
- } else {
285
- fn(fullPath, relative(dir, fullPath));
279
+ const root = dir;
280
+ const walk = (current) => {
281
+ for (const entry of readdirSync(current, { withFileTypes: true })) {
282
+ const fullPath = join(current, entry.name);
283
+ if (entry.isDirectory()) {
284
+ walk(fullPath);
285
+ } else {
286
+ // rel must be relative to the walked root, not the current subdirectory
287
+ fn(fullPath, relative(root, fullPath));
288
+ }
286
289
  }
287
- }
290
+ };
291
+ walk(root);
288
292
  }
289
293
 
290
294
  function deleteObsoleteManagedFiles(targetDir, managedPaths, zipFilenames) {
@@ -320,7 +324,7 @@ function deleteObsoleteManagedFiles(targetDir, managedPaths, zipFilenames) {
320
324
  return deleted;
321
325
  }
322
326
 
323
- async function extractZipWithManifest(buf, targetDir, { preserved, managed }) {
327
+ export async function extractZipWithManifest(buf, targetDir, { preserved, managed }) {
324
328
  const eocdOff = findEocd(buf);
325
329
  const cdSize = read32(buf, eocdOff + 12);
326
330
  const cdOff = read32(buf, eocdOff + 16);