small fixes on example
This commit is contained in:
@@ -2,15 +2,15 @@
|
|||||||
|
|
||||||
import freeflowuniverse.herolib.vfs.webdav
|
import freeflowuniverse.herolib.vfs.webdav
|
||||||
import freeflowuniverse.herolib.vfs.vfsnested
|
import freeflowuniverse.herolib.vfs.vfsnested
|
||||||
import freeflowuniverse.herolib.vfs.ourdb_fs
|
|
||||||
import freeflowuniverse.herolib.vfs.vfscore
|
import freeflowuniverse.herolib.vfs.vfscore
|
||||||
|
import freeflowuniverse.herolib.vfs.vfsourdb
|
||||||
|
|
||||||
mut high_level_vfs := vfsnested.new()
|
mut high_level_vfs := vfsnested.new()
|
||||||
|
|
||||||
// lower level VFS Implementations that use OurDB
|
// lower level VFS Implementations that use OurDB
|
||||||
mut vfs1 := vfscore.new_local_vfs('/tmp/test_webdav_ourdbvfs/vfs1')!
|
mut vfs1 := vfsourdb.new('/tmp/test_webdav_ourdbvfs/vfs1', '/tmp/test_webdav_ourdbvfs/vfs1')!
|
||||||
mut vfs2 := vfscore.new_local_vfs('/tmp/test_webdav_ourdbvfs/vfs2')!
|
mut vfs2 := vfsourdb.new('/tmp/test_webdav_ourdbvfs/vfs2', '/tmp/test_webdav_ourdbvfs/vfs2')!
|
||||||
mut vfs3 := vfscore.new_local_vfs('/tmp/test_webdav_ourdbvfs/vfs3')!
|
mut vfs3 := vfsourdb.new('/tmp/test_webdav_ourdbvfs/vfs3', '/tmp/test_webdav_ourdbvfs/vfs3')!
|
||||||
|
|
||||||
// Nest OurDB VFS instances at different paths
|
// Nest OurDB VFS instances at different paths
|
||||||
high_level_vfs.add_vfs('/data', vfs1) or { panic(err) }
|
high_level_vfs.add_vfs('/data', vfs1) or { panic(err) }
|
||||||
@@ -20,4 +20,4 @@ high_level_vfs.add_vfs('/data/backup', vfs3) or { panic(err) } // Nested under /
|
|||||||
// Create WebDAV Server that uses high level VFS
|
// Create WebDAV Server that uses high level VFS
|
||||||
webdav_server := webdav.new_app(
|
webdav_server := webdav.new_app(
|
||||||
vfs: high_level_vfs
|
vfs: high_level_vfs
|
||||||
)
|
)!
|
||||||
|
|||||||
@@ -111,8 +111,8 @@ pub fn (mut self NestedVFS) dir_delete(path string) ! {
|
|||||||
return impl.dir_delete(rel_path)
|
return impl.dir_delete(rel_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn (mut self NestedVFS) exists(path string) !bool {
|
pub fn (mut self NestedVFS) exists(path string) bool {
|
||||||
mut impl, rel_path := self.find_vfs(path)!
|
mut impl, rel_path := self.find_vfs(path) or {return false}
|
||||||
return impl.exists(rel_path)
|
return impl.exists(rel_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ pub fn (mut self OurDBVFS) dir_delete(path string) ! {
|
|||||||
parent_dir.rm(dir_name)!
|
parent_dir.rm(dir_name)!
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn (mut self OurDBVFS) exists(path string) !bool {
|
pub fn (mut self OurDBVFS) exists(path string) bool {
|
||||||
if path == '/' {
|
if path == '/' {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user