diff --git a/scripts/libs/vshell.inc.src b/scripts/libs/vshell.inc.src index 0f54f8ae9e235514aaec443b1da6662f6ca04166..e4dba7e63e4cb6f4e26dda6be181a3350e7ddb2c 100644 --- a/scripts/libs/vshell.inc.src +++ b/scripts/libs/vshell.inc.src @@ -1,3 +1,7 @@ +// Untested! +// This file has only been merged into master because it depended into the Repo Unification Process +// Which caused a lot of merge conflicts, so reducing merge requests made life easier for everybody at the time + "#import libs/utils.inc.src" "#import libs/file.inc.src" @@ -18,6 +22,7 @@ imports.vshell.constrs.shell = function(object) cmd = imports.utils.SafeMapAccess(imports.vshell.cmds,command[0]) if cmd == null then print(cmd+ " is not a recognized command") + return end if // Remove the command name @@ -26,8 +31,16 @@ imports.vshell.constrs.shell = function(object) params.push(command[i]) end for + heart = result.heart + current_path = result.current_path + result = cmd(self, params) - if result and typeof(result) != "function" then print(command[0] +" error: "+result) + if result and typeof(result) != "function" then + print(command[0] +" error: "+result) + // Rollback + result.heart = heart + result.current_path = current_path + end if end while end function @@ -47,8 +60,17 @@ imports.vshell.constrs.shell = function(object) result = self.heart.File(path) end if - self.current_path = imports.file.GetDir(result.path) + if not imports.file.FileAccess(result,"r") then + print("Error, unable to access the file") + return + end if + folder = imports.file.GetDirRef(result) + if not imports.file.FileAccess(folder,"r") then + print("Error, unable to access the parent folder") + return + end if + self.current_path = folder.path if typeof(self.heart) == "file" then self.heart = result return result end function @@ -111,4 +133,7 @@ imports.vshell.cmds.read = function(shell, params) end function imports.vshell.cmds.get = function(shell, params) +end function + +imports.vshell.cmds.delete = function(shell, params) end function \ No newline at end of file