latex-stickies 1.3.5 → 1.3.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "latex-stickies",
3
- "version": "1.3.5",
3
+ "version": "1.3.6",
4
4
  "description": "Sticky notes for your desktop that render LaTeX and Markdown.",
5
5
  "main": "src/main.js",
6
6
  "scripts": {
@@ -72,7 +72,10 @@ function main() {
72
72
  }
73
73
  };
74
74
 
75
- if (read('CFBundleName') === NAME && read('CFBundleIdentifier') === APP_ID) {
75
+ const binary = path.join(appPath, 'Contents', 'MacOS', NAME);
76
+ if (read('CFBundleName') === NAME
77
+ && read('CFBundleIdentifier') === APP_ID
78
+ && fs.existsSync(binary)) {
76
79
  // Already named, so a wrong name in the Dock can only be a stale cache.
77
80
  refreshLaunchServices(appPath);
78
81
  // Say so rather than exiting in silence. A user reporting "the Dock still
@@ -90,6 +93,7 @@ function main() {
90
93
  ['CFBundleName', NAME],
91
94
  ['CFBundleDisplayName', NAME],
92
95
  ['CFBundleIdentifier', APP_ID],
96
+ ['CFBundleExecutable', NAME],
93
97
  ];
94
98
  for (const [key, value] of fields) {
95
99
  try {
@@ -99,6 +103,21 @@ function main() {
99
103
  }
100
104
  }
101
105
 
106
+ // Rename the executable too. macOS takes the Dock label from the running
107
+ // executable, not only from the plist -- which is why the packaged builds
108
+ // have always shown the right name (electron-builder renames it) while
109
+ // every npm install showed "Electron" however the plist was rewritten.
110
+ const oldBinary = path.join(appPath, 'Contents', 'MacOS', 'Electron');
111
+ if (fs.existsSync(oldBinary) && !fs.existsSync(binary)) {
112
+ fs.renameSync(oldBinary, binary);
113
+ }
114
+ // require('electron') reads this file for the path it returns, so it has
115
+ // to follow the rename or every launcher breaks.
116
+ const pathTxt = path.join(path.dirname(appPath), '..', 'path.txt');
117
+ if (fs.existsSync(pathTxt)) {
118
+ fs.writeFileSync(pathTxt, `Electron.app/Contents/MacOS/${NAME}`);
119
+ }
120
+
102
121
  // The bundle icon is what shows before the app can set its own.
103
122
  const icon = path.join(__dirname, '..', 'build', 'icon.icns');
104
123
  const target = path.join(appPath, 'Contents', 'Resources', 'electron.icns');