Unify build fs layout (#6717)

* unify build fs layout

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* use currentApp path for static files

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* lint fix

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* absolute override path for tests

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
Jari Kolehmainen authored and GitHub committed 2022-12-12 11:23:45 -05:00
1 parent fe0c13424a
commit 4ac47fa795
14 files changed
+46 -45

No files matched your search

@@ -9,13 +9,17 @@ interface Dependencies {
app: App;
}
export type GetElectronAppPath = (name: PathName) => string;
export type GetElectronAppPath = (name: PathName | "currentApp") => string;
export const getElectronAppPath = ({
app,
}: Dependencies): GetElectronAppPath => (
(name) => {
try {
if (name === "currentApp") {
return app.getAppPath();
}
return app.getPath(name);
} catch (e) {
return "";
@@ -4,7 +4,6 @@
*/
import { getInjectable } from "@ogre-tools/injectable";
import staticFilesDirectoryInjectable from "../../../common/vars/static-files-directory.injectable";
import isDevelopmentInjectable from "../../../common/vars/is-development.injectable";
import isMacInjectable from "../../../common/vars/is-mac.injectable";
import { camelCase, flow, upperFirst } from "lodash/fp";
import joinPathsInjectable from "../../../common/path/join-paths.injectable";
@@ -16,12 +15,11 @@ const getTrayIconPathInjectable = getInjectable({
instantiate: (di) => {
const joinPaths = di.inject(joinPathsInjectable);
const staticFilesDirectory = di.inject(staticFilesDirectoryInjectable);
const isDevelopment = di.inject(isDevelopmentInjectable);
const isMac = di.inject(isMacInjectable);
const baseIconDirectory = joinPaths(
staticFilesDirectory,
isDevelopment ? "../build/tray" : "icons", // copied within electron-builder extras
"build/tray",
);
const fileSuffix = isMac ? "Template.png" : ".png";