show_hidden_files option for mac/linux

Massimo Melina committed Sep 25, 2024 at 16:43 UTC 28f0978cef16359115a3073a261953cd08ca1411
3 files changed +4 -2
admin/src/OptionsPage.ts
+1 -1
@@ -210,7 +210,7 @@ export default function OptionsPage() {
210 label: "Calculate ZIP size for", helperText: "If time is not enough, the browser will not show download percentage" },
211
212 { k: 'descript_ion', comp: BoolField, ...isWindows && { sm: 4, md: 3 }, label: "Enable comments", helperText: "In file DESCRIPT.ION" },
213 - isWindows && { k: 'show_hidden_files', comp: BoolField, sm: 4, md: 3, helperText: "Showing makes search faster" },
213 + { k: 'show_hidden_files', comp: BoolField, sm: 4, md: 3, helperText: isWindows && "Showing makes search faster" },
214 { k: 'descript_ion_encoding', sm: 4, md: 6, label: "Encoding of file DESCRIPT.ION", comp: SelectField, disabled: !values.descript_ion,
215 options: ['utf8',720,775,819,850,852,862,869,874,808, ..._.range(1250,1257),10029,20866,21866] },
216
src/dirStream.ts
+2
@@ -54,6 +54,8 @@ export function createDirStream(startPath: string, { depth=0, hidden=true }) {
54 let n = 0
55 for await (let entry of await readdir(base, { withFileTypes: true })) {
56 if (stopped) break
57 + if (!IS_WINDOWS && !hidden && entry.name[0] === '.')
58 + continue
59 const stats = entry.isSymbolicLink() && await stat(join(base, entry.name)).catch(() => null)
60 if (stats === null) continue
61 if (stats)
src/vfs.ts
+1 -1
@@ -115,7 +115,7 @@ export async function urlToNode(url: string, ctx?: Koa.Context, parent: VfsNode=
115 return urlToNode(rest, ctx, ret, getRest)
116 if (ret.source)
117 try {
118 - if (IS_WINDOWS && !showHiddenFiles.get() && isHiddenFile(ret.source))
118 + if (!showHiddenFiles.get() && isHiddenFile(ret.source))
119 throw 'hiddenFile'
120 const st = ret.stats || await fs.stat(ret.source) // check existence
121 ret.isFolder = st.isDirectory()