Skip to content

Commit

Permalink
Update downloads-manager extension (#15995)
Browse files Browse the repository at this point in the history
* Update downloads-manager extension

* Update downloads-manager extension
  • Loading branch information
ridemountainpig authored Dec 22, 2024
1 parent 1bcd3d9 commit 075164f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
4 changes: 4 additions & 0 deletions extensions/downloads-manager/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Downloads Manager Changelog

## [Add show hidden files preference] - {PR_MERGE_DATE}

- Added a preference to show hidden files in the `Manage Downloads` command

## [Add close window script] - 2024-10-29

- Added a script to close the window to ensure it closes after the action is completed
Expand Down
13 changes: 12 additions & 1 deletion extensions/downloads-manager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,18 @@
"name": "manage-downloads",
"title": "Manage Downloads",
"description": "Search and organize your downloaded files",
"mode": "view"
"mode": "view",
"preferences": [
{
"type": "checkbox",
"name": "showHiddenFiles",
"label": "Show Hidden Files",
"title": "Show Hidden Files",
"description": "Show hidden files in the folder",
"required": false,
"default": false
}
]
},
{
"name": "open-latest-download",
Expand Down
5 changes: 3 additions & 2 deletions extensions/downloads-manager/src/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ import { join } from "path";
import { ComponentType } from "react";
import untildify from "untildify";

const preferences: Preferences = getPreferenceValues();
const preferences = getPreferenceValues();
export const downloadsFolder = untildify(preferences.downloadsFolder ?? "~/Downloads");
const showHiddenFiles = preferences.showHiddenFiles;

export function getDownloads() {
const files = readdirSync(downloadsFolder);
return files
.filter((file) => !file.startsWith("."))
.filter((file) => showHiddenFiles || !file.startsWith("."))
.map((file) => {
const path = join(downloadsFolder, file);
const lastModifiedAt = statSync(path).mtime;
Expand Down

0 comments on commit 075164f

Please sign in to comment.