mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-26 09:16:22 +02:00
feat: implement upload-based folder indexing and synchronization features
This commit is contained in:
parent
b3925654dd
commit
5f5954e932
13 changed files with 1273 additions and 45 deletions
|
|
@ -188,6 +188,31 @@ function walkFolderMtimes(config: WatchedFolderConfig): MtimeMap {
|
|||
return result;
|
||||
}
|
||||
|
||||
export interface FolderFileEntry {
|
||||
relativePath: string;
|
||||
fullPath: string;
|
||||
size: number;
|
||||
mtimeMs: number;
|
||||
}
|
||||
|
||||
export function listFolderFiles(config: WatchedFolderConfig): FolderFileEntry[] {
|
||||
const root = config.path;
|
||||
const mtimeMap = walkFolderMtimes(config);
|
||||
const entries: FolderFileEntry[] = [];
|
||||
|
||||
for (const [relativePath, mtimeMs] of Object.entries(mtimeMap)) {
|
||||
const fullPath = path.join(root, relativePath);
|
||||
try {
|
||||
const stat = fs.statSync(fullPath);
|
||||
entries.push({ relativePath, fullPath, size: stat.size, mtimeMs });
|
||||
} catch {
|
||||
// File may have been removed between walk and stat
|
||||
}
|
||||
}
|
||||
|
||||
return entries;
|
||||
}
|
||||
|
||||
function getMainWindow(): BrowserWindow | null {
|
||||
const windows = BrowserWindow.getAllWindows();
|
||||
return windows.length > 0 ? windows[0] : null;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue