Skip to content

Commit

Permalink
#76 Fixes error when deleting last item in folder.
Browse files Browse the repository at this point in the history
  • Loading branch information
mattstermiller committed Jan 17, 2020
1 parent 7d0e4b2 commit 35fa3b7
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
3 changes: 3 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Release Notes

### 0.5.2 (2020-01-17)
- #76 Fixes error when deleting the last item in a folder

### 0.5.1 (2019-11-15)
- #75 Fixes crash on startup when the Koffee AppData folder does not exist

Expand Down
4 changes: 2 additions & 2 deletions src/Koffee/AssemblyInfo.fs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ open System.Runtime.InteropServices
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [<assembly: AssemblyVersion("1.0.*")>]
[<assembly: AssemblyVersion("0.5.1")>]
[<assembly: AssemblyFileVersion("0.5.1")>]
[<assembly: AssemblyVersion("0.5.2")>]
[<assembly: AssemblyFileVersion("0.5.2")>]

do
()
11 changes: 3 additions & 8 deletions src/Koffee/MainController.fs
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,7 @@ module Nav =
|> List.filter (fun i -> model.Config.ShowHidden || not i.IsHidden ||
String.equalsIgnoreCase selectName i.Name)
|> (model.Sort |> Option.map SortField.SortByTypeThen |? id)
|> Seq.ifEmpty (
let text =
if model.Location = Path.Network then "Remote hosts that you visit will appear here"
else "Empty folder"
[ { Item.Empty with Name = sprintf "<%s>" text; Path = model.Location } ]
)
|> Seq.ifEmpty (Item.EmptyFolder model.Location)
{ model with Items = items } |> select selectType

let openPath (fsReader: IFileSystemReader) path select (model: MainModel) = result {
Expand Down Expand Up @@ -617,7 +612,7 @@ module Action =
yield
{ model with
Directory = model.Directory |> List.except [item]
Items = model.Items |> List.except [item]
Items = model.Items |> List.except [item] |> Seq.ifEmpty (Item.EmptyFolder model.Location)
}.WithCursor model.Cursor
|> performedAction action
}
Expand All @@ -628,7 +623,7 @@ module Action =
yield
{ model with
Directory = model.Directory |> List.except [model.SelectedItem]
Items = model.Items |> List.except [model.SelectedItem]
Items = model.Items |> List.except [model.SelectedItem] |> Seq.ifEmpty (Item.EmptyFolder model.Location)
History = model.History.WithoutNetHost host
Status = Some <| MainStatus.removedNetworkHost host
}.WithCursor model.Cursor
Expand Down
6 changes: 6 additions & 0 deletions src/Koffee/MainModel.fs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ with
Modified = None; Size = None; IsHidden = false
}

static member EmptyFolder path =
let text =
if path = Path.Network then "Remote hosts that you visit will appear here"
else "Empty folder"
[ { Item.Empty with Name = sprintf "<%s>" text; Path = path } ]

static member Basic path name itemType =
{ Item.Empty with
Path = path
Expand Down

0 comments on commit 35fa3b7

Please sign in to comment.