diff --git a/extensions/open-folders/src/desktop.tsx b/extensions/open-folders/src/desktop.tsx index ed3ba00336f..ff0a79f4f50 100644 --- a/extensions/open-folders/src/desktop.tsx +++ b/extensions/open-folders/src/desktop.tsx @@ -1,10 +1,7 @@ import { open, getPreferenceValues } from "@raycast/api"; -interface Preferences { - desktopdir: string; -} +const dir = getPreferenceValues().desktopdir; export default function Command() { - const dir = getPreferenceValues().desktopdir; return open(`${dir}`); } diff --git a/extensions/open-folders/src/documents.tsx b/extensions/open-folders/src/documents.tsx index 4bee7da85cd..655fad0e9dd 100644 --- a/extensions/open-folders/src/documents.tsx +++ b/extensions/open-folders/src/documents.tsx @@ -1,10 +1,7 @@ import { open, getPreferenceValues } from "@raycast/api"; -interface Preferences { - documentsdir: string; -} +const dir = getPreferenceValues().documentsdir; export default function Command() { - const dir = getPreferenceValues().documentsdir; return open(`${dir}`); } diff --git a/extensions/open-folders/src/downloads.tsx b/extensions/open-folders/src/downloads.tsx index acf7024b58d..f74b8f9cd79 100644 --- a/extensions/open-folders/src/downloads.tsx +++ b/extensions/open-folders/src/downloads.tsx @@ -1,10 +1,7 @@ import { open, getPreferenceValues } from "@raycast/api"; -interface Preferences { - downloadsdir: string; -} +const dir = getPreferenceValues().downloadsdir; export default function Command() { - const dir = getPreferenceValues().downloadsdir; return open(`${dir}`); } diff --git a/extensions/open-folders/src/fileSpeedDial.tsx b/extensions/open-folders/src/fileSpeedDial.tsx index 5d0b28f2ffe..a1d8a406244 100644 --- a/extensions/open-folders/src/fileSpeedDial.tsx +++ b/extensions/open-folders/src/fileSpeedDial.tsx @@ -1,31 +1,22 @@ import { open, getPreferenceValues, Grid, ActionPanel, Action } from "@raycast/api"; -interface Preferences { - fileOne: string; - fileTwo: string; - fileThree: string; - fileFour: string; - fileFive: string; - fileSix: string; - fileSeven: string; - fileEight: string; -} +const preferences = getPreferenceValues(); -const preferences = [ - getPreferenceValues().fileOne, - getPreferenceValues().fileTwo, - getPreferenceValues().fileThree, - getPreferenceValues().fileFour, - getPreferenceValues().fileFive, - getPreferenceValues().fileSix, - getPreferenceValues().fileSeven, - getPreferenceValues().fileEight, +const fileLocations = [ + preferences.fileOne, + preferences.fileTwo, + preferences.fileThree, + preferences.fileFour, + preferences.fileFive, + preferences.fileSix, + preferences.fileSeven, + preferences.fileEight, ]; export default function Command() { const files: Map = new Map(); - preferences.forEach((element) => { + fileLocations.forEach((element) => { if (element != null && element != "") { files.set(files.size, element); } diff --git a/extensions/open-folders/src/folderSpeedDial.tsx b/extensions/open-folders/src/folderSpeedDial.tsx index 0bb67f48fc5..067b29e6205 100644 --- a/extensions/open-folders/src/folderSpeedDial.tsx +++ b/extensions/open-folders/src/folderSpeedDial.tsx @@ -1,31 +1,22 @@ import { open, getPreferenceValues, Grid, ActionPanel, Action } from "@raycast/api"; -interface Preferences { - dirOne: string; - dirTwo: string; - dirThree: string; - dirFour: string; - dirFive: string; - dirSix: string; - dirSeven: string; - dirEight: string; -} +const preferences = getPreferenceValues(); -const preferences = [ - getPreferenceValues().dirOne, - getPreferenceValues().dirTwo, - getPreferenceValues().dirThree, - getPreferenceValues().dirFour, - getPreferenceValues().dirFive, - getPreferenceValues().dirSix, - getPreferenceValues().dirSeven, - getPreferenceValues().dirEight, +const folders = [ + preferences.dirOne, + preferences.dirTwo, + preferences.dirThree, + preferences.dirFour, + preferences.dirFive, + preferences.dirSix, + preferences.dirSeven, + preferences.dirEight, ]; export default function Command() { const directories: Map = new Map(); - preferences.forEach((element) => { + folders.forEach((element) => { if (element != null && element != "") { directories.set(directories.size, element); } diff --git a/extensions/open-folders/src/listDownloads.tsx b/extensions/open-folders/src/listDownloads.tsx index a1c9164d9b1..d1b9468c040 100644 --- a/extensions/open-folders/src/listDownloads.tsx +++ b/extensions/open-folders/src/listDownloads.tsx @@ -1,13 +1,9 @@ import { ActionPanel, Action, List, Grid, getPreferenceValues } from "@raycast/api"; import { readdirSync, Dirent, statSync } from "fs"; -interface Preferences { - downloadedFilesdir: string; - layout: string; -} - -const dir = getPreferenceValues().downloadedFilesdir; -const layout = getPreferenceValues().layout; +const preferences = getPreferenceValues(); +const dir = preferences.downloadedFilesdir; +const layout = preferences.layout; export default function Command() { const dirContents = readdirSync(dir, { withFileTypes: true }).sort((a, b) => { diff --git a/extensions/open-folders/src/listFolders.tsx b/extensions/open-folders/src/listFolders.tsx index 0c3a1e61598..d48b038fb55 100644 --- a/extensions/open-folders/src/listFolders.tsx +++ b/extensions/open-folders/src/listFolders.tsx @@ -1,13 +1,10 @@ import { ActionPanel, Action, List, Grid, getPreferenceValues } from "@raycast/api"; import { readdirSync } from "fs"; -interface Preferences { - homedir: string; - layout: string; -} +const preferences = getPreferenceValues(); -const dir = getPreferenceValues().homedir; -const layout = getPreferenceValues().layout; +const dir = preferences.homedir; +const layout = preferences.layout; export default function Command() { if (layout == "List") { diff --git a/extensions/open-folders/src/mostRecent.tsx b/extensions/open-folders/src/mostRecent.tsx index 52c5fc21af1..ad82172e9c7 100644 --- a/extensions/open-folders/src/mostRecent.tsx +++ b/extensions/open-folders/src/mostRecent.tsx @@ -1,11 +1,7 @@ import { open, getPreferenceValues } from "@raycast/api"; import { readdirSync, statSync } from "fs"; -interface Preferences { - downloadsdir: string; -} - -const downloadsdir = getPreferenceValues().downloadsdir; +const downloadsdir = getPreferenceValues().downloadsdir; export default function Command() { const dirContents = readdirSync(downloadsdir, { withFileTypes: true }).sort((a, b) => { diff --git a/extensions/open-folders/src/projects.tsx b/extensions/open-folders/src/projects.tsx index 7480018cea5..7eff575000c 100644 --- a/extensions/open-folders/src/projects.tsx +++ b/extensions/open-folders/src/projects.tsx @@ -1,10 +1,7 @@ import { open, getPreferenceValues } from "@raycast/api"; -interface Preferences { - projectsdir: string; -} +const dir = getPreferenceValues().projectsdir; export default function Command() { - const dir = getPreferenceValues().projectsdir; return open(`${dir}`); }