Skip to content

Commit

Permalink
feat(GUI): Preserve the last directory selected for download
Browse files Browse the repository at this point in the history
  • Loading branch information
vegidio committed Dec 27, 2024
1 parent a9f04a9 commit 100419d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ root = true
[*]
charset = utf-8
indent_size = 4
indent_style = tab
indent_style = space
insert_final_newline = false
max_line_length = 120
trim_trailing_whitespace = true
Expand All @@ -13,5 +13,8 @@ ij_kotlin_name_count_to_use_star_import = 999
ij_kotlin_packages_to_use_import_on_demand = unset
ij_visual_guides = none

[*.go]
indent_style = tab

[*.yml]
indent_size = 2
3 changes: 2 additions & 1 deletion gui/frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ const App = () => {

useEffect(() => {
const getHomeDirectory = async () => {
const dir = await GetHomeDirectory()
let dir = localStorage.getItem('lastDirectory')
if (!dir) dir = await GetHomeDirectory()
store.setDirectory(dir)
}

Expand Down
2 changes: 2 additions & 0 deletions gui/frontend/src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ export const useAppStore = create(
},

setDirectory: (directory: string) => {
localStorage.setItem('lastDirectory', directory)

set(state => {
state.directory = directory
})
Expand Down

0 comments on commit 100419d

Please sign in to comment.