osx-sign icon indicating copy to clipboard operation
osx-sign copied to clipboard

fix: sort file name length if same directory

Open aquacash5 opened this issue 3 years ago • 2 comments

I just had this issue where my app would not sign. I am adding a couple of extra binaries to the Contents/MacOS directory. The file names happened to be longer than the application name. I spent two days trying to figure out why these files wouldn't sign.

This was my solution and it seems to work well.

aquacash5 avatar Feb 03 '22 19:02 aquacash5

Can you please rebase this for CI fixes 👍

MarshallOfSound avatar Mar 24 '22 06:03 MarshallOfSound

Done!

I also have added another level of sorting. I recently ran into the same issue when the file names were the same length.

aquacash5 avatar Mar 24 '22 09:03 aquacash5

I am going to close this PR. After running into this issue again, I believe the true problem is that the electron binary has to be signed last. This isn't a problem for projects that only consist of the one electron binary, but our project includes a series of side binaries that must be signed first.

My current fix is to modify the sort function (using patch-package) as follows:

childPaths = childPaths.sort((a, b) => {
+ if (a.endsWith('executable-name')) return 1
+ if (b.endsWith('executable-name')) return -1
  const aDepth = a.split(path.sep).length
  const bDepth = b.split(path.sep).length
  return bDepth - aDepth

aquacash5 avatar Oct 07 '22 14:10 aquacash5