Rename the Teleprompt app to Files, improve its navigation and add support for images

This commit is contained in:
James Babcock committed 2026-07-25 21:33:58 -07:00
1 parent 8cc29acaea
commit 3c2f53ed75
15 files changed
+1035 -246

No files matched your search

+21
View File
@@ -18,6 +18,8 @@ export type DirectoryEntry = {
path: string;
isDirectory: boolean;
sizeBytes: number;
/** Last-modified time in epoch ms; 0 when unknown. */
modifiedMs: number;
};
export function hasAllFilesAccess(): boolean {
@@ -60,6 +62,7 @@ export function listDirectory(path: string): DirectoryEntry[] | null {
path: String(file.getAbsolutePath()),
isDirectory: Boolean(file.isDirectory()),
sizeBytes: Number(file.length()),
modifiedMs: Number(file.lastModified()),
});
}
entries.sort((a, b) => {
@@ -73,6 +76,24 @@ export function listDirectory(path: string): DirectoryEntry[] | null {
}
}
/** Stat a single path; null when it does not exist or cannot be checked. */
export function statPath(path: string): DirectoryEntry | null {
try {
const file = new java.io.File(path);
if (!file.exists()) return null;
return {
name: String(file.getName()),
path: String(file.getAbsolutePath()),
isDirectory: Boolean(file.isDirectory()),
sizeBytes: Number(file.length()),
modifiedMs: Number(file.lastModified()),
};
} catch (error) {
console.warn(`statPath failed for ${path}: ${error}`);
return null;
}
}
/** Write UTF-8 text to a file in the public Downloads directory; returns its path or null. */
export function writeTextToDownloads(filename: string, text: string): string | null {
try {