small fixes on example

This commit is contained in:
timurgordon
2025-02-18 05:22:38 +03:00
parent 906f13b562
commit 6305cf159e
3 changed files with 8 additions and 8 deletions

View File

@@ -2,15 +2,15 @@
import freeflowuniverse.herolib.vfs.webdav
import freeflowuniverse.herolib.vfs.vfsnested
import freeflowuniverse.herolib.vfs.ourdb_fs
import freeflowuniverse.herolib.vfs.vfscore
import freeflowuniverse.herolib.vfs.vfsourdb
mut high_level_vfs := vfsnested.new()
// lower level VFS Implementations that use OurDB
mut vfs1 := vfscore.new_local_vfs('/tmp/test_webdav_ourdbvfs/vfs1')!
mut vfs2 := vfscore.new_local_vfs('/tmp/test_webdav_ourdbvfs/vfs2')!
mut vfs3 := vfscore.new_local_vfs('/tmp/test_webdav_ourdbvfs/vfs3')!
mut vfs1 := vfsourdb.new('/tmp/test_webdav_ourdbvfs/vfs1', '/tmp/test_webdav_ourdbvfs/vfs1')!
mut vfs2 := vfsourdb.new('/tmp/test_webdav_ourdbvfs/vfs2', '/tmp/test_webdav_ourdbvfs/vfs2')!
mut vfs3 := vfsourdb.new('/tmp/test_webdav_ourdbvfs/vfs3', '/tmp/test_webdav_ourdbvfs/vfs3')!
// Nest OurDB VFS instances at different paths
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
webdav_server := webdav.new_app(
vfs: high_level_vfs
)
)!

View File

@@ -111,8 +111,8 @@ pub fn (mut self NestedVFS) dir_delete(path string) ! {
return impl.dir_delete(rel_path)
}
pub fn (mut self NestedVFS) exists(path string) !bool {
mut impl, rel_path := self.find_vfs(path)!
pub fn (mut self NestedVFS) exists(path string) bool {
mut impl, rel_path := self.find_vfs(path) or {return false}
return impl.exists(rel_path)
}

View File

@@ -96,7 +96,7 @@ pub fn (mut self OurDBVFS) dir_delete(path string) ! {
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 == '/' {
return true
}