Skip to content

Commit 1dd055f

Browse files
committed
use remove homedir
1 parent 1f9bef8 commit 1dd055f

7 files changed

Lines changed: 15 additions & 2 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ Please note that this application is for viewing and managing iMessage conversat
2020

2121
Mimessage also creates an "iMessage Wrapped" - a Spotify Wrapped, but for your conversations. It will generate some statistics about your conversations.
2222

23+
![Wrapped](readme-assets/wrapped.png?raw=true "My iMessage Wrapped")
24+
2325
Fun sidenote: ChatGPT actually came up with a lot of the stats that would be interesting to see.
2426

2527
![ChatGPT ideas](readme-assets/chatgpt.png?raw=true "ChatGPT generated the stats")

electron-src/data/ipc.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ handleIpc("openFileAtFolder", (filePath: string) => {
2828
shell.showItemInFolder(filePath);
2929
});
3030

31+
handleIpc("getHomeDir", () => {
32+
return os.homedir();
33+
});
34+
3135
type EnhancedChat = NonNullable<Awaited<ReturnType<SQLDatabase["getChatList"]>>>[number];
3236
handleIpc(
3337
"export",

readme-assets/chatgpt.png

-230 KB
Loading

readme-assets/img.png

-7.97 KB
Loading

readme-assets/wrapped.png

1.02 MB
Loading

src/components/message/AttachmentView.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { isProd } from "../../config";
44
import { useMimessage } from "../../context";
55
import Box from "@mui/material/Box";
66
import { MessageBubbleText } from "./MessageBubble";
7-
import { useOpenFileAtLocation } from "../../hooks/dataHooks";
7+
import { useHomeDir, useOpenFileAtLocation } from "../../hooks/dataHooks";
88
const ASSET_WIDTH = "100%";
99
const ASSET_HEIGHT = "100%";
1010

@@ -15,8 +15,9 @@ export const AttachmentView = ({ message, recalcSize }: { recalcSize?: () => voi
1515
const ref = useRef<HTMLVideoElement>(null);
1616
const setHighlightedMessage = useMimessage((state) => state.setHighlightedMessage);
1717

18+
const { data: homedir } = useHomeDir();
1819
const data = useOpenFileAtLocation();
19-
const absolutePath = (message.filename || "").replace("~", process.env.HOME!);
20+
const absolutePath = (message.filename || "").replace("~", homedir!);
2021
const filename = ((isProd ? "file://" : "mimessage-asset://") + absolutePath) as string;
2122
const fileType = filename.split(".").pop()?.toLowerCase();
2223
const isVideo = VIDEO_TYPES.includes(fileType!);

src/hooks/dataHooks.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,12 @@ export const useHasSemanticSearch = () => {
538538
});
539539
};
540540

541+
export const useHomeDir = () => {
542+
return useQuery<string>(["getHomeDir"], async () => {
543+
return (await ipcRenderer.invoke("getHomeDir")) as string;
544+
});
545+
};
546+
541547
export const useSemanticSearchStats = (enabled: boolean) => {
542548
return useQuery<SemanticSearchStats>(
543549
["calculateSemanticSearchStats"],

0 commit comments

Comments
 (0)