Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- isExist = function(x,y)
- filePath = x + "/" + y;
- file = get_shell.host_computer.File(filePath);
- if typeof(file) == "file" then
- return true;
- else
- return false;
- end if
- end function
- createFile = function(x,y,z)
- if isExist(x,y) == false then
- if z == "file" then
- get_shell.host_computer.touch(x,y);
- else if z == "folder" then
- get_shell.host_computer.create_folder(x,y);
- else
- return "Can only create file or folder."
- end if
- else
- return "File Already exist.";
- end if
- end function
- contentFile = function(x,y,z)
- file = get_shell.host_computer.File((x + "/" + y));
- if typeof(file) == "file" then
- file.set_content(z);
- else
- return "File not found.";
- end if
- end function
- DirManager = function(w,x,y,z)
- FileAction = w;
- FilePath = x;
- FileName = y;
- FileType = z;
- if FileAction == "create" then
- createFile(FilePath,FileName,FileType);
- else if FileAction == "content" then
- contentFile(FilePath,FileName,FileType);
- else
- return "Action provided is not available. Actions are 'create','content'";
- end if
- end function
Advertisement
Add Comment
Please, Sign In to add comment