refactor: Remove unnecessary debug print statements

- Removed numerous println statements throughout the codebase.
This commit is contained in:
Mahmoud Emad
2025-02-18 17:45:29 +02:00
parent 7b453962ca
commit 4691046d5f
6 changed files with 0 additions and 29 deletions

View File

@@ -1,7 +1,6 @@
module encoder
import time
import freeflowuniverse.herolib.ui.console
// example see https://github.com/vlang/v/blob/master/examples/compiletime/reflection.v

View File

@@ -183,7 +183,6 @@ fn (mut lut LookupTable) set(x u32, location Location) ! {
return
}
println('lut.data.len: ${lut.data.len}')
if id * u32(entry_size) >= u32(lut.data.len) {
return error('Index out of bounds')
}

View File

@@ -139,8 +139,6 @@ pub fn (mut dir Directory) mkdir(name string) !&Directory {
}
current_time := time.now().unix()
println('parent_id: dir.metadata.id: ${dir.metadata.id}')
println('dir.children: ${dir.children}')
mut new_dir := Directory{
metadata: Metadata{
// id: u32(time.now().unix()) // Use timestamp as ID
@@ -165,8 +163,6 @@ pub fn (mut dir Directory) mkdir(name string) !&Directory {
dir.children << new_dir.metadata.id
dir.metadata.id = dir.myvfs.save_entry(dir)!
println('dir.children: ${dir.children}')
println('new_dir: ${new_dir}')
return &new_dir
}
@@ -246,7 +242,6 @@ pub fn (mut dir Directory) rm(name string) ! {
// get_children returns all immediate children as FSEntry objects
pub fn (mut dir Directory) children(recursive bool) ![]FSEntry {
mut entries := []FSEntry{}
println('dir.children: ${dir.children}')
for child_id in dir.children {
entry := dir.myvfs.load_entry(child_id)!
entries << entry

View File

@@ -93,8 +93,6 @@ pub fn decode_directory(data []u8) !Directory {
children << d.get_u32()!
}
println('Decoded children: ${children}')
return Directory{
metadata: metadata
parent_id: parent_id

View File

@@ -17,9 +17,7 @@ pub mut:
// get_root returns the root directory
pub fn (mut fs OurDBFS) get_root() !&Directory {
// Try to load root directory from DB if it exists
println('Root id is ${fs.root_id}')
if data := fs.db_meta.get(fs.root_id) {
println('decode_directory(data): ${decode_directory(data)!.metadata}')
mut loaded_root := decode_directory(data) or {
return error('Failed to decode root directory: ${err}')
}
@@ -78,8 +76,6 @@ pub fn (mut fs OurDBFS) save_entry(entry FSEntry) !u32 {
match entry {
Directory {
encoded := entry.encode()
println('entry.metadata.id: ${entry.metadata.id}')
println('name: ${entry.metadata.name}')
return fs.db_meta.set(data: encoded) or {
return error('Failed to save directory on id:${entry.metadata.id}: ${err}')
}

View File

@@ -35,10 +35,7 @@ pub fn (mut self OurDBVFS) file_create(path string) !vfscore.FSEntry {
parent_path := os.dir(path)
file_name := os.base(path)
println('file path: ${path}')
println('parent_path: ${parent_path}')
mut parent_dir := self.get_directory(parent_path)!
println('parent_dir file: ${parent_dir}')
mut file := parent_dir.touch(file_name)!
return convert_to_vfscore_entry(file)
}
@@ -54,7 +51,6 @@ pub fn (mut self OurDBVFS) file_read(path string) ![]u8 {
pub fn (mut self OurDBVFS) file_write(path string, data []u8) ! {
mut entry := self.get_entry(path)!
println('file_write - entry type: ${typeof(entry).name}')
if mut entry is ourdb_fs.File {
entry.write(data.bytestr())!
} else {
@@ -85,10 +81,7 @@ pub fn (mut self OurDBVFS) dir_create(path string) !vfscore.FSEntry {
dir_name := os.base(path)
mut parent_dir := self.get_directory(parent_path)!
println('parent_dir: ${parent_dir}')
println('dir_name: ${dir_name}')
mut new_dir := parent_dir.mkdir(dir_name)!
println('new_dir: ${new_dir}')
new_dir.save()! // Ensure the directory is saved
return convert_to_vfscore_entry(new_dir)
@@ -181,18 +174,13 @@ fn (mut self OurDBVFS) get_entry(path string) !ourdb_fs.FSEntry {
mut current := *self.core.get_root()!
parts := path.trim_left('/').split('/')
println('Traversing path: ${path}')
println('Parts: ${parts}')
for i := 0; i < parts.len; i++ {
mut found := false
children := current.children(false)!
println('Current directory: ${current.metadata.name}')
println('Children: ${children}')
for child in children {
if child.metadata.name == parts[i] {
println('Found match: ${child.metadata.name}')
match child {
ourdb_fs.Directory {
current = child
@@ -211,7 +199,6 @@ fn (mut self OurDBVFS) get_entry(path string) !ourdb_fs.FSEntry {
}
if !found {
println('Path not found: ${parts[i]}')
return error('Path not found: ${path}')
}
}
@@ -230,15 +217,12 @@ fn (mut self OurDBVFS) get_directory(path string) !&ourdb_fs.Directory {
fn convert_to_vfscore_entry(entry ourdb_fs.FSEntry) vfscore.FSEntry {
match entry {
ourdb_fs.Directory {
println('Entry is a directory: ${entry}')
println('Entry is a directory: ${convert_metadata(entry.metadata)}')
return &DirectoryEntry{
metadata: convert_metadata(entry.metadata)
path: entry.metadata.name
}
}
ourdb_fs.File {
println('Entry is a file: ${entry}')
return &FileEntry{
metadata: convert_metadata(entry.metadata)
path: entry.metadata.name