Ejemplo n.º 1
0
        public static void ChangeCurrentDirectoryAbsolute(string absolutePath)
        {
            if (!Directory.Exists(absolutePath))
            {
                OutputWriter.DisplayException(ExceptionMessages.InvalidPath);
                return;
            }

            SessionData.SetCurrentDirectoryPath(absolutePath);
        }
Ejemplo n.º 2
0
 public static void ChangeCurrentDirectoryRelative(string relativePath)
 {
     if (relativePath == "..")
     {
         try
         {
             string currentPath      = SessionData.GetCurrentDirectoryPath();
             int    indexOfLastSlash = currentPath.LastIndexOf("\\");
             string newPath          = currentPath.Substring(0, indexOfLastSlash);
             SessionData.SetCurrentDirectoryPath(newPath);
         }
         catch (ArgumentOutOfRangeException)
         {
             OutputWriter.DisplayException(ExceptionMessages.UnableToGoHigherInPartitionHierarchy);
         }
     }
     else
     {
         string currentPath = SessionData.GetCurrentDirectoryPath();
         currentPath += "\\" + relativePath;
         ChangeCurrentDirectoryAbsolute(currentPath);
     }
 }