public void ChangeCurrentDirectoryAbsolute(string absolutePath) { if (!Directory.Exists(absolutePath)) { throw new InvalidPathException(); } SessionData.ChangeCurrentDirectoryPath(absolutePath); }
public void ChangeCurrentDirectoryRelative(string relativePath) { if (relativePath == "..") { try { string currentPath = SessionData.GetCurrentDirectoryPath(); int indexOfLastSlash = currentPath.LastIndexOf("\\"); string newPath = currentPath.Substring(0, indexOfLastSlash); SessionData.ChangeCurrentDirectoryPath(newPath); } catch (ArgumentOutOfRangeException) { throw new ArgumentOutOfRangeException("indexOfLastSlash", ExceptionMessages.UnableToGoHigherInPartitionHierarchy); } } else { string currentPath = SessionData.GetCurrentDirectoryPath(); currentPath += "\\" + relativePath; ChangeCurrentDirectoryAbsolute(currentPath); } }