Skip to content

Commit

Permalink
Preserve mode
Browse files Browse the repository at this point in the history
  • Loading branch information
JrMasterModelBuilder committed Oct 21, 2023
1 parent c731ab4 commit 6df9c7a
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/projector/otto/mac.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import {readFile, mkdir, writeFile} from 'node:fs/promises';
import {readFile, mkdir, writeFile, chmod} from 'node:fs/promises';
import {join as pathJoin, basename, dirname} from 'node:path';

import {
PathType,
Entry,
createArchiveByFileStatOrThrow
createArchiveByFileStatOrThrow,
fsLchmodSupported,
fsLchmod
} from '@shockpkg/archive-files';
import {Plist, ValueDict, ValueString} from '@shockpkg/plist-dom';

Expand Down Expand Up @@ -557,6 +559,14 @@ export class ProjectorOttoMac extends ProjectorOtto {
if (data) {
await mkdir(dirname(dest), {recursive: true});
await writeFile(dest, data);
const {mode} = entry;
if (mode) {
if (fsLchmodSupported) {
await fsLchmod(dest, mode);
} else {
await chmod(dest, mode);
}
}
return;
}

Expand Down

0 comments on commit 6df9c7a

Please sign in to comment.