mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
use currentApp path for static files
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
1 parent
e2d3f5ad4e
commit
c69ad966d8
9 files changed
+39
-19
No files matched your search
@@ -4,9 +4,10 @@
|
||||
*/
|
||||
import type { app as electronApp } from "electron";
|
||||
|
||||
export type PathName = Parameters<typeof electronApp["getPath"]>[0];
|
||||
export type PathName = Parameters<typeof electronApp["getPath"]>[0] | "currentApp";
|
||||
|
||||
export const pathNames: PathName[] = [
|
||||
"currentApp",
|
||||
"home",
|
||||
"appData",
|
||||
"userData",
|
||||
|
||||
@@ -19,6 +19,7 @@ describe("app-paths", () => {
|
||||
builder = getApplicationBuilder();
|
||||
|
||||
const defaultAppPathsStub: AppPaths = {
|
||||
currentApp: "some-current-app",
|
||||
appData: "some-app-data",
|
||||
cache: "some-cache",
|
||||
crashDumps: "some-crash-dumps",
|
||||
@@ -70,6 +71,7 @@ describe("app-paths", () => {
|
||||
const actual = windowDi.inject(appPathsInjectionToken);
|
||||
|
||||
expect(actual).toEqual({
|
||||
currentApp: "some-current-app",
|
||||
appData: "some-app-data",
|
||||
cache: "some-cache",
|
||||
crashDumps: "some-crash-dumps",
|
||||
@@ -93,6 +95,7 @@ describe("app-paths", () => {
|
||||
const actual = mainDi.inject(appPathsInjectionToken);
|
||||
|
||||
expect(actual).toEqual({
|
||||
currentApp: "some-current-app",
|
||||
appData: "some-app-data",
|
||||
cache: "some-cache",
|
||||
crashDumps: "some-crash-dumps",
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getGlobalOverride } from "../test-utils/get-global-override";
|
||||
import staticFilesDirectoryInjectable from "./static-files-directory.injectable";
|
||||
|
||||
|
||||
export default getGlobalOverride(staticFilesDirectoryInjectable, () => "some-static-directory");
|
||||
@@ -3,6 +3,7 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import appPathsInjectable from "../app-paths/app-paths.injectable";
|
||||
import joinPathsInjectable from "../path/join-paths.injectable";
|
||||
|
||||
const staticFilesDirectoryInjectable = getInjectable({
|
||||
@@ -10,8 +11,9 @@ const staticFilesDirectoryInjectable = getInjectable({
|
||||
|
||||
instantiate: (di) => {
|
||||
const joinPaths = di.inject(joinPathsInjectable);
|
||||
const currentAppDir = di.inject(appPathsInjectable).currentApp;
|
||||
|
||||
return joinPaths(__dirname, "..");
|
||||
return joinPaths(currentAppDir, "static");
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user