Skip to content
Source
Sign inSign up
pingdotgg/t3code

Use xdg directories: Separate configuration, data, state, cache, and runtime storage #4437

Closedcolonelpanic8(GitHub profile, opens in a new tab)wants to merge 8 commits intomain fromrefs/pull/4437/headopened View on GitHub

Showing 30 changed files with 79 additions and 3 deletions (loading 27).

x
0 of 30 viewed, 30 left
48 additions and 0 deletionsapps/desktop/src/app/DesktopApp.test.tsAdded
View file
@@ -0,0 +1,48 @@
+import * as NodeServices from "@effect/platform-node/NodeServices";
+import { assert, describe, it } from "@effect/vitest";
+import * as Effect from "effect/Effect";
+import * as FileSystem from "effect/FileSystem";
+import * as Layer from "effect/Layer";
+​
+import * as ElectronApp from "../electron/ElectronApp.ts";
+import { configureElectronStoragePaths } from "./DesktopApp.ts";
+​
+describe("configureElectronStoragePaths", () => {
+ it.effect("creates a fresh split-layout cache directory before configuring Electron", () =>
+ Effect.gen(function* () {
+ const fileSystem = yield* FileSystem.FileSystem;
+ const root = yield* fileSystem.makeTempDirectoryScoped({
+ prefix: "t3-desktop-electron-storage-",
+ });
+ const electronCachePath = `${root}/cache/electron`;
+ const configuredPaths: Array<readonly [string, string]> = [];
+ const electronAppLayer = Layer.succeed(
+ ElectronApp.ElectronApp,
+ ElectronApp.ElectronApp.of({
+ setPath: (name, path) =>
+ name === "cache"
+ ? fileSystem.exists(path).pipe(
+ Effect.map((exists) => {
+ assert.isTrue(exists);
+ configuredPaths.push([name, path]);
+ }),
+ )
+ : Effect.sync(() => {