🌈️ apply a wallpaper based on the weather outside
0

Configure Feed

Select the types of activity you want to include in your feed.

fix(analyze): use path.join instead of string concatenation

Angel Wang (Jun 23, 2026, 1:01 AM -0600) 53a0dae2 267cd98e

+5 -5
+5 -5
src/analyze/analysis.ts
··· 25 25 const images = await fs.promises.opendir(imageDir) 26 26 27 27 for await (const image of images) { 28 - const path = `${imageDir}/${image.name}` 29 - const stat = await fs.promises.stat(path) 28 + const imagePath = path.join(imageDir, image.name) 29 + const stat = await fs.promises.stat(imagePath) 30 30 if (stat.isFile()) { 31 - let output = await $`magick ${path} -colorspace Oklch -kmeans 10 -format "%c" histogram:info:`.then( 31 + let output = await $`magick ${imagePath} -colorspace Oklch -kmeans 10 -format "%c" histogram:info:`.then( 32 32 (s) => 33 33 s.stdout 34 34 .split("\n") ··· 41 41 console.log( 42 42 `-kmeans 10 of ${image.name} didn't give enough colours, trying again with a higher value...`, 43 43 ) 44 - output = await $`magick ${path} -colorspace Oklch -kmeans 40 -format "%c" histogram:info:`.then( 44 + output = await $`magick ${imagePath} -colorspace Oklch -kmeans 40 -format "%c" histogram:info:`.then( 45 45 (s) => 46 46 s.stdout 47 47 .split("\n") // split the output by newlines ··· 72 72 const chroma = Number(dominantColour[1]) 73 73 const hue = Number(dominantColour[2]) 74 74 75 - analysisOutput.files.push({ path: path, oklch: [lightness, chroma, hue] }) 75 + analysisOutput.files.push({ path: imagePath, oklch: [lightness, chroma, hue] }) 76 76 77 77 // flush every time we finish analyzing a file, because it just takes so long 78 78 fs.writeFile(outputPath, JSON.stringify(analysisOutput, null, 4), (err: Error) => {