Skip to content

Commit 4da7ec6

Browse files
nodeeeeeeclaude
andcommitted
Fix align:scan path resolution — check DATA_DIR first, not OutputDir
Root cause: align:scan looked for course data under getOutputDir() (~/AutoNote by default) but Python saves under DATA_DIR (~/.auto_note). On the user's machine ~/AutoNote/COURSE_ID may exist (from previous pipeline runs) so the fallback never triggered, and the mapping file was never found. Fix: scan all candidate locations (DATA_DIR first, then OutputDir) and pick whichever has the captions/ directory. This matches Python's COURSE_DATA_DIR resolution logic. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 8ccf99d commit 4da7ec6

2 files changed

Lines changed: 18 additions & 13 deletions

File tree

electron/main.js

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -843,13 +843,16 @@ function registerIpc() {
843843

844844
// ── Align: scan captions + slides, load/save mapping ───────────────────
845845
ipcMain.handle('align:scan', (_, cid) => {
846-
// Course data may be under OUTPUT_DIR (user-configured) or DATA_DIR (~/.auto_note/)
847-
const outDir = getOutputDir();
848-
let base = path.join(outDir, String(cid));
849-
if (!fs.existsSync(base)) {
850-
// Fallback: check DATA_DIR (where Python scripts store data by default)
851-
const altBase = path.join(DATA_DIR, String(cid));
852-
if (fs.existsSync(altBase)) base = altBase;
846+
// Course data may be under OUTPUT_DIR or DATA_DIR (~/.auto_note/).
847+
// Python uses COURSE_DATA_DIR = config.OUTPUT_DIR or DATA_DIR.
848+
// Check all possible locations and use whichever has the captions/ dir.
849+
const candidates = [
850+
path.join(DATA_DIR, String(cid)),
851+
path.join(getOutputDir(), String(cid)),
852+
];
853+
let base = candidates[0]; // default to DATA_DIR
854+
for (const c of candidates) {
855+
if (fs.existsSync(path.join(c, 'captions'))) { base = c; break; }
853856
}
854857
const capDir = path.join(base, 'captions');
855858
const matDir = path.join(base, 'materials');
@@ -1108,11 +1111,13 @@ function registerIpc() {
11081111
});
11091112

11101113
ipcMain.handle('align:saveMapping', (_, { cid, mapping }) => {
1111-
const outDir = getOutputDir();
1112-
let base = path.join(outDir, String(cid));
1113-
if (!fs.existsSync(base)) {
1114-
const altBase = path.join(DATA_DIR, String(cid));
1115-
if (fs.existsSync(altBase)) base = altBase;
1114+
const candidates = [
1115+
path.join(DATA_DIR, String(cid)),
1116+
path.join(getOutputDir(), String(cid)),
1117+
];
1118+
let base = candidates[0];
1119+
for (const c of candidates) {
1120+
if (fs.existsSync(path.join(c, 'captions'))) { base = c; break; }
11161121
}
11171122
const alignDir = path.join(base, 'alignment');
11181123
if (!fs.existsSync(alignDir)) fs.mkdirSync(alignDir, { recursive: true });

electron/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "auto-note",
3-
"version": "0.9.31",
3+
"version": "0.9.32",
44
"description": "AutoNote — lecture notes generator from Canvas recordings",
55
"homepage": "https://github.com/nodeeeeee/Auto-Note",
66
"author": {

0 commit comments

Comments
 (0)