withoutFolders guesses where a path starts and ends, and five review
passes each found a line it let a folder through: blanks, soft stops, a
kept stop in a folder name, the fallback after a cut, a path glued to a
character that starts nothing. The new src/services/logFolders.ts knows
the two folders that hold the OS user name instead: the home folder
(homeDir) becomes "~" and the folder of the profile databases
(appConfigDir) "<profile folder>", the latter first.
- replaceKnownFolders: either separator and any run of them between
segments (JSON.stringify doubles each backslash), case ignored with a
drive letter, trailing separator of the folder dropped, and a
boundary after it, so /home/max leaves /home/maxime alone. Never
throws.
- setKnownFolders builds the patterns once, every segment escaped
(CWE-185: a raw "(" would make every captured console call throw),
and ignores an empty or root folder.
- initKnownFolders resolves both folders once, independently
(Promise.allSettled), never rejected; knownFoldersReady resolves when
they are known or 2 s after initKnownFolders, and at once when it was
never called.
logService replaces them in every entry, whatever its channel, and
replayLogEntries rewrites the entries written before they arrived,
sessionStorage included; main.tsx wires it right after initLogCapture.
db.ts waits for knownFoldersReady inside the exclusive section of
connectToProfile, before repair_migrations, and its four sites clean a
line with cleanLogLine: the exact folders, then withoutFolders, which
does not change. "Migration checksums repaired for" goes through
logWarn, and startupConnection writes through a logError that App.tsx
passes: neither file writes to the Journal through console.* any more.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
28 lines
1,020 B
TypeScript
28 lines
1,020 B
TypeScript
import React from "react";
|
|
import ReactDOM from "react-dom/client";
|
|
import App from "./App";
|
|
import { LicenseProvider } from "./contexts/LicenseContext";
|
|
import { ProfileProvider } from "./contexts/ProfileContext";
|
|
import ErrorBoundary from "./components/shared/ErrorBoundary";
|
|
import { initLogCapture, replayLogEntries } from "./services/logService";
|
|
import { initKnownFolders } from "./services/logFolders";
|
|
import "./i18n/config";
|
|
import "./styles.css";
|
|
|
|
initLogCapture();
|
|
// The home and profile folders, replaced exactly in every Journal entry
|
|
// (#497): the entries written before they arrive are rewritten then, even
|
|
// after the 2 s that connectToProfile waits for them at most.
|
|
void initKnownFolders().then(replayLogEntries);
|
|
|
|
ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
|
|
<React.StrictMode>
|
|
<LicenseProvider>
|
|
<ProfileProvider>
|
|
<ErrorBoundary>
|
|
<App />
|
|
</ErrorBoundary>
|
|
</ProfileProvider>
|
|
</LicenseProvider>
|
|
</React.StrictMode>,
|
|
);
|