Skip to content
Extraits de code Groupes Projets
Valider 13076fcc rédigé par LaplongeJunior's avatar LaplongeJunior
Parcourir les fichiers

Added delete command

parent 64868fa7
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -53,20 +53,19 @@ imports.vshell.constrs.shell = function(object)
path = imports.file.AbsolutePath(path)
if typeof(self.heart) != "file" then // is a computer
if isFile then
result = imports.vshell.navigate(self.heart, path)
else
result = self.heart.File(path)
end if
if not imports.file.FileAccess(result,"r") then
print("Error, unable to access the file")
print("Error, unable to access the target")
return
end if
folder = imports.file.GetDirRef(result)
if not imports.file.FileAccess(folder,"r") then
print("Error, unable to access the parent folder")
print("Error, unable to access the target's folder")
return
end if
......@@ -115,7 +114,8 @@ end function
imports.vshell.cmds.cd = function(shell, params)
if params.len == 0 then path = "" else path = params[0]
file = imports.file.GetDirRef(shell.navigate(path))
if not shell.navigate(path).is_folder then return "target is not a folder!"
if not imports.file.FileAccess(file,"r") then return "Unable to read cd target"
names = []
for item in file.get_folders
......@@ -130,10 +130,17 @@ imports.vshell.cmds.cd = function(shell, params)
end function
imports.vshell.cmds.read = function(shell, params)
if params.len > 0 then return "Parameter required"
file = shell.navigate(params[0])
end function
imports.vshell.cmds.get = function(shell, params)
if params.len > 0 then return "Parameter required"
end function
imports.vshell.cmds.delete = function(shell, params)
if params.len > 0 then return "Parameter required"
file = shell.navigate(params[0])
if not imports.utils.UserPrompt("Do you *REALLY* want to delete '"+file.path+"' ?") then return "Execution cancelled by user"
if not imports.file.delete(file) then return "Permission defined"
end function
\ No newline at end of file
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter