Permalink
Browse files

Ensure toplevel dirs are not dropped.

  • Loading branch information...
1 parent 1575df8 commit bdfc63b76188789daf0a34f9241499db1f285734 Han-Wen Nienhuys committed Apr 24, 2012
Showing with 5 additions and 4 deletions.
  1. +5 −4 fs.go
View
9 fs.go
@@ -98,10 +98,6 @@ type fileNode struct {
dirty bool
}
-func (n *fileNode) Deletable() bool {
- return false
-}
-
func (n *fileNode) OnForget() {
if n.file != nil {
n.file.Destroy()
@@ -253,6 +249,11 @@ type folderNode struct {
folders map[string]*File
}
+// Keep the root nodes for all device storages alive.
+func (n *folderNode) Deletable() bool {
+ return n.id != NOPARENT_ID
+}
+
// Fetches data from device returns false on failure.
func (n *folderNode) fetch() bool {
if n.files != nil {

0 comments on commit bdfc63b

Please sign in to comment.