From 3f190b4cfada1a8012a1cf983cb070a56bb39b20 Mon Sep 17 00:00:00 2001
From: LaplongeJunior <laplongejunior@gmail.com>
Date: Sat, 1 Aug 2020 16:55:28 +0000
Subject: [PATCH] Added cd implementation

---
 scripts/libs/vshell.inc.src | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/scripts/libs/vshell.inc.src b/scripts/libs/vshell.inc.src
index de94096..0f54f8a 100644
--- a/scripts/libs/vshell.inc.src
+++ b/scripts/libs/vshell.inc.src
@@ -47,9 +47,7 @@ imports.vshell.constrs.shell = function(object)
             result = self.heart.File(path)
         end if
             
-        folder = result
-        if not folder.is_folder then folder = folder.parent 
-        self.current_path = folder.path
+        self.current_path = imports.file.GetDir(result.path)
         
         if typeof(self.heart) == "file" then self.heart = result
         return result
@@ -94,9 +92,18 @@ imports.vshell.cmds.help = function(shell, params)
 end function
 
 imports.vshell.cmds.cd = function(shell, params)
-    if params.len == 0 then 
-    file = shell.navigate(path)
-    print("List of accepted commands:")
+    if params.len == 0 then path = "" else path = params[0]
+    file = imports.file.GetDirRef(shell.navigate(path))
+    
+    names = []
+    for item in file.get_folders
+        names = item.name+"/"
+    end for
+    for item in file.get_files
+        names = item.name
+    end for
+    
+    print("List of folders in: "+file.path)
     print(imports.utils.PrintList(names,imports.file.NEW_LINE))
 end function
 
-- 
GitLab