public ResultOrError <string> CreateDirectory(string path) { string newPath = ResolvePath(path); try { foreach (var c in newPath) { if ((int)c > 255) { throw new Exception("Invalid characters in directory name"); } } var newpath = DecodePath(newPath); clovershell.ExecuteSimple("mkdir \"" + newpath + "\""); } catch (Exception ex) { return(MakeError <string>(ex.Message)); } return(MakeResult <string>(newPath)); }
public ResultOrError <string> ChangeDirectory(string path) { string newPath = ResolvePath(path); try { clovershell.ExecuteSimple("cd \"" + newPath + "\"", 1000, true); currentPath = newPath; } catch (Exception ex) { return(MakeError <string>(ex.Message)); } return(MakeResult <string>(newPath)); }