Skip to content

Commit 76ebf49

Browse files
committed
Fixed #15 Linux AppImage/.deb file error finding binary in .resources dir
1 parent 1c48094 commit 76ebf49

File tree

4 files changed

+76
-75
lines changed

4 files changed

+76
-75
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,13 @@ $ cd exifcleaner
123123
Next, install the NPM package dependencies.
124124

125125
```bash
126-
$ npm install
126+
$ yarn install
127127
```
128128

129129
Finally, launch the application. This supports Hot Module Reload (HMR) so you will automatically see your changes every time you save a file.
130130

131131
```bash
132-
$ npm run dev
132+
$ yarn run dev
133133
```
134134

135135
### Contributing
@@ -141,8 +141,8 @@ This app is mostly feature complete. I want to keep it simple and not add a bunc
141141
This section is really for my own reference when publishing a new release.
142142

143143
```
144-
$ npm run release
145-
$ npm run dist
144+
$ yarn run release
145+
$ yarn run dist
146146
```
147147

148-
Or instead of `npm run dist`, after Travis finishes building your app, open the release draft it created and click "Publish".
148+
Or instead of `yarn run dist`, after Travis finishes building your app, open the release draft it created and click "Publish".

src/common/binaries.js

Lines changed: 53 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,64 @@
11
import path from "path";
22
import { remote } from "electron";
3-
import getPlatform from "./get_platform";
3+
import { getPlatform, NIX, MAC, WIN } from "./get_platform";
44

55
const IS_PROD = process.env.NODE_ENV === "production";
66
const root = process.cwd();
77
const { isPackaged, getAppPath } = remote.app;
88

9-
const binariesPath =
10-
IS_PROD && isPackaged
11-
? path.join(path.dirname(getAppPath()), "..", "./Resources", "./bin")
12-
: path.join(root, "./.resources", getPlatform(), "./bin");
9+
function getDevBinariesPath() {
10+
path.join(root, "./.resources", getPlatform(), "./bin");
11+
}
1312

14-
const binFilename = getPlatform() === "win" ? "./exiftool.exe" : "./exiftool";
13+
function getProdBinariesPath() {
14+
const platform = getPlatform();
15+
16+
console.log(`platform: ${platform}`);
17+
switch (platform) {
18+
case WIN:
19+
case MAC:
20+
return path.join(
21+
path.dirname(getAppPath()),
22+
"..",
23+
"./Resources",
24+
"./bin"
25+
);
26+
case NIX:
27+
return path.join(
28+
path.dirname(getAppPath()),
29+
"..",
30+
"./resources",
31+
"./bin"
32+
);
33+
default:
34+
throw `Could not determine the production binary path for ExifTool on platform ${platform}`;
35+
}
36+
}
37+
38+
function getBinariesPath() {
39+
return IS_PROD && isPackaged ? getProdBinariesPath() : getDevBinariesPath();
40+
}
41+
42+
const binariesPath = getBinariesPath();
43+
44+
const BIN_FILENAME_WIN = "exiftool.exe";
45+
const BIN_FILENAME_NIX_MAC = "exiftool";
46+
47+
function getBinFilename() {
48+
const platform = getPlatform();
49+
50+
switch (platform) {
51+
case WIN:
52+
return BIN_FILENAME_WIN;
53+
case NIX:
54+
case MAC:
55+
return BIN_FILENAME_NIX_MAC;
56+
default:
57+
throw `Could not determine the ExifTool binary path for platform ${platform}`;
58+
}
59+
}
60+
61+
const binFilename = getBinFilename();
1562
export const exiftoolBinPath = path.resolve(
1663
path.join(binariesPath, binFilename)
1764
);

src/common/get_platform.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
11
import { platform } from "os";
22

3-
export default () => {
4-
switch (platform()) {
3+
export const NIX = "nix";
4+
export const MAC = "mac";
5+
export const WIN = "win";
6+
7+
export function getPlatform() {
8+
const currentPlatform = platform();
9+
10+
switch (currentPlatform) {
511
case "aix":
612
case "freebsd":
713
case "linux":
814
case "openbsd":
915
case "android":
10-
return "nix";
11-
case "darwin":
1216
case "sunos":
13-
return "nix";
17+
return NIX;
18+
case "darwin":
19+
return MAC;
1420
case "win32":
15-
return "win";
21+
return WIN;
1622
}
17-
};
23+
}

yarn.lock

Lines changed: 5 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -786,11 +786,6 @@
786786
resolved "https://registry.yarnpkg.com/@types/q/-/q-1.5.2.tgz#690a1475b84f2a884fd07cd797c00f5f31356ea8"
787787
integrity sha512-ce5d3q03Ex0sy4R14722Rmt6MT07Ua+k4FwDfdcToYJcMKNtRVQvJ6JCAPdAmAnbRb6CsX6aYb9m96NGod9uTw==
788788

789-
"@types/semver@^6.0.2":
790-
version "6.2.0"
791-
resolved "https://registry.yarnpkg.com/@types/semver/-/semver-6.2.0.tgz#d688d574400d96c5b0114968705366f431831e1a"
792-
integrity sha512-1OzrNb4RuAzIT7wHSsgZRlMBlNsJl+do6UblR7JMW4oB7bbR+uBEYtUh7gEc/jM84GGilh68lSOokyM/zNUlBA==
793-
794789
"@types/webpack-env@^1.13.9":
795790
version "1.14.1"
796791
resolved "https://registry.yarnpkg.com/@types/webpack-env/-/webpack-env-1.14.1.tgz#0d8a53f308f017c53a5ddc3d07f4d6fa76b790d7"
@@ -1653,14 +1648,6 @@ [email protected]:
16531648
debug "^4.1.1"
16541649
sax "^1.2.4"
16551650

1656-
1657-
version "8.4.0"
1658-
resolved "https://registry.yarnpkg.com/builder-util-runtime/-/builder-util-runtime-8.4.0.tgz#3163fffc078e6b8f3dd5b6eb12a8345573590682"
1659-
integrity sha512-CJB/eKfPf2vHrkmirF5eicVnbDCkMBbwd5tRYlTlgud16zFeqD7QmrVUAOEXdnsrcNkiLg9dbuUsQKtl/AwsYQ==
1660-
dependencies:
1661-
debug "^4.1.1"
1662-
sax "^1.2.4"
1663-
16641651
16651652
version "8.5.0"
16661653
resolved "https://registry.yarnpkg.com/builder-util-runtime/-/builder-util-runtime-8.5.0.tgz#0c9faa782307867cc2ec70f25e63829ef1ea49c4"
@@ -2853,16 +2840,6 @@ dir-glob@^2.2.2:
28532840
dependencies:
28542841
path-type "^3.0.0"
28552842

2856-
dist-exiftool@^10.53.0:
2857-
version "10.53.0"
2858-
resolved "https://registry.yarnpkg.com/dist-exiftool/-/dist-exiftool-10.53.0.tgz#8bd17bac1e43deacd81d9adacd0f1e24c690100f"
2859-
integrity sha1-i9F7rB5D3qzYHZrazQ8eJMaQEA8=
2860-
dependencies:
2861-
platform-dependent-modules "0.0.14"
2862-
optionalDependencies:
2863-
exiftool.exe "10.53"
2864-
exiftool.pl "10.53"
2865-
28662843
28672844
version "21.2.0"
28682845
resolved "https://registry.yarnpkg.com/dmg-builder/-/dmg-builder-21.2.0.tgz#a9c883557cacb9abdb66c7133b30fe921c1a3ba7"
@@ -3155,20 +3132,6 @@ electron-unhandled@^3.0.0:
31553132
ensure-error "^2.0.0"
31563133
lodash.debounce "^4.0.8"
31573134

3158-
electron-updater@^4.2.0:
3159-
version "4.2.0"
3160-
resolved "https://registry.yarnpkg.com/electron-updater/-/electron-updater-4.2.0.tgz#f9ecfc657f65ead737d42b9efecf628d3756b550"
3161-
integrity sha512-GuS3g7HDh17x/SaFjxjswlWUaKHczksYkV2Xc5CKj/bZH0YCvTSHtOmnBAdAmCk99u/71p3zP8f0jIqDfGcjww==
3162-
dependencies:
3163-
"@types/semver" "^6.0.2"
3164-
builder-util-runtime "8.4.0"
3165-
fs-extra "^8.1.0"
3166-
js-yaml "^3.13.1"
3167-
lazy-val "^1.0.4"
3168-
lodash.isequal "^4.5.0"
3169-
pako "^1.0.10"
3170-
semver "^6.3.0"
3171-
31723135
electron-util@^0.13.0:
31733136
version "0.13.0"
31743137
resolved "https://registry.yarnpkg.com/electron-util/-/electron-util-0.13.0.tgz#bce9032ab07cab3bc3448451f2a48a766ef51cce"
@@ -3755,16 +3718,6 @@ execa@^3.4.0:
37553718
signal-exit "^3.0.2"
37563719
strip-final-newline "^2.0.0"
37573720

3758-
3759-
version "10.53.0"
3760-
resolved "https://registry.yarnpkg.com/exiftool.exe/-/exiftool.exe-10.53.0.tgz#22b1ce60fb8db589469d1aa5b0a1fe09a35bc454"
3761-
integrity sha1-IrHOYPuNtYlGnRqlsKH+CaNbxFQ=
3762-
3763-
3764-
version "10.53.0"
3765-
resolved "https://registry.yarnpkg.com/exiftool.pl/-/exiftool.pl-10.53.0.tgz#63c1646b3ad0aed1ce1313d7b5d07da4d7b13d84"
3766-
integrity sha1-Y8FkazrQrtHOExPXtdB9pNexPYQ=
3767-
37683721
expand-brackets@^2.1.4:
37693722
version "2.1.4"
37703723
resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-2.1.4.tgz#b77735e315ce30f6b6eff0f83b04151a22449622"
@@ -6507,10 +6460,10 @@ node-releases@^1.1.42:
65076460
dependencies:
65086461
semver "^6.3.0"
65096462

6510-
node-sass@^4.13.0:
6511-
version "4.13.0"
6512-
resolved "https://registry.yarnpkg.com/node-sass/-/node-sass-4.13.0.tgz#b647288babdd6a1cb726de4545516b31f90da066"
6513-
integrity sha512-W1XBrvoJ1dy7VsvTAS5q1V45lREbTlZQqFbiHb3R3OTTCma0XBtuG6xZ6Z4506nR4lmHPTqVRwxT6KgtWC97CA==
6463+
node-sass@^4.13.1:
6464+
version "4.14.0"
6465+
resolved "https://registry.yarnpkg.com/node-sass/-/node-sass-4.14.0.tgz#a8e9d7720f8e15b4a1072719dcf04006f5648eeb"
6466+
integrity sha512-AxqU+DFpk0lEz95sI6jO0hU0Rwyw7BXVEv6o9OItoXLyeygPeaSpiV4rwQb10JiTghHaa0gZeD21sz+OsQluaw==
65146467
dependencies:
65156468
async-foreach "^0.1.3"
65166469
chalk "^1.1.1"
@@ -7022,7 +6975,7 @@ package-json@^6.3.0:
70226975
registry-url "^5.0.0"
70236976
semver "^6.2.0"
70246977

7025-
pako@^1.0.10, pako@~1.0.5:
6978+
pako@~1.0.5:
70266979
version "1.0.10"
70276980
resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.10.tgz#4328badb5086a426aa90f541977d4955da5c9732"
70286981
integrity sha512-0DTvPVU3ed8+HNXOu5Bs+o//Mbdj9VNQMUOe9oKCwh8l0GNwpTDMKCWbRjgtD291AWnkAgkqA/LOnQS8AmS1tw==
@@ -7266,11 +7219,6 @@ pkg-up@^3.0.1:
72667219
dependencies:
72677220
find-up "^3.0.0"
72687221

7269-
7270-
version "0.0.14"
7271-
resolved "https://registry.yarnpkg.com/platform-dependent-modules/-/platform-dependent-modules-0.0.14.tgz#3c53d0415d81ce22dcfde15665d0cfd541d41617"
7272-
integrity sha1-PFPQQV2BziLc/eFWZdDP1UHUFhc=
7273-
72747222
plur@^3.0.1:
72757223
version "3.1.1"
72767224
resolved "https://registry.yarnpkg.com/plur/-/plur-3.1.1.tgz#60267967866a8d811504fe58f2faaba237546a5b"

0 commit comments

Comments
 (0)