Browse Source

Dropping no-longer working and never-documented LockInHome feature

Source commit: bc360b54365994cbcfaac592d766fe52ae4f1dc8
Martin Prikryl 4 years ago
parent
commit
42a30f9e94

+ 1 - 3
source/components/UnixDirView.cpp

@@ -904,9 +904,7 @@ void __fastcall TUnixDirView::ChangeDirectory(UnicodeString Path)
     {
       Terminal->HomeDirectory();
     }
-    else
-    // this works even with LockInHome
-    if (Path == ROOTDIRECTORY)
+    else if (Path == ROOTDIRECTORY)
     {
       Terminal->CurrentDirectory = ROOTDIRECTORY;
     }

+ 15 - 6
source/core/RemoteFiles.cpp

@@ -1449,20 +1449,29 @@ UnicodeString __fastcall TRemoteFile::GetListingStr()
 //---------------------------------------------------------------------------
 UnicodeString __fastcall TRemoteFile::GetFullFileName() const
 {
+  UnicodeString Result;
   if (FFullFileName.IsEmpty())
   {
     DebugAssert(Terminal);
     DebugAssert(Directory != NULL);
-    UnicodeString Path;
-    if (IsParentDirectory) Path = Directory->ParentPath;
-    else if (IsDirectory) Path = UnixIncludeTrailingBackslash(Directory->FullDirectory + FileName);
-    else Path = Directory->FullDirectory + FileName;
-    return Terminal->TranslateLockedPath(Path, true);
+    if (IsParentDirectory)
+    {
+      Result = Directory->ParentPath;
+    }
+    else if (IsDirectory)
+    {
+      Result = UnixIncludeTrailingBackslash(Directory->FullDirectory + FileName);
+    }
+    else
+    {
+      Result = Directory->FullDirectory + FileName;
+    }
   }
   else
   {
-    return FFullFileName;
+    Result = FFullFileName;
   }
+  return Result;
 }
 //---------------------------------------------------------------------------
 bool __fastcall TRemoteFile::GetHaveFullFileName() const

+ 0 - 9
source/core/SessionData.cpp

@@ -239,7 +239,6 @@ void __fastcall TSessionData::DefaultSettings()
   CacheDirectories = true;
   CacheDirectoryChanges = true;
   PreserveDirectoryChanges = true;
-  LockInHome = false;
   ResolveSymlinks = true;
   FollowDirectorySymlinks = false;
   DSTMode = dstmUnix;
@@ -395,7 +394,6 @@ void __fastcall TSessionData::NonPersistant()
   PROPERTY(ResolveSymlinks); \
   PROPERTY(FollowDirectorySymlinks); \
   PROPERTY(DSTMode); \
-  PROPERTY(LockInHome); \
   PROPERTY(Special); \
   PROPERTY(Selected); \
   PROPERTY(ReturnVar); \
@@ -734,7 +732,6 @@ void __fastcall TSessionData::DoLoad(THierarchicalStorage * Storage, bool PuttyI
   ResolveSymlinks = Storage->ReadBool(L"ResolveSymlinks", ResolveSymlinks);
   FollowDirectorySymlinks = Storage->ReadBool(L"FollowDirectorySymlinks", FollowDirectorySymlinks);
   DSTMode = (TDSTMode)Storage->ReadInteger(L"ConsiderDST", DSTMode);
-  LockInHome = Storage->ReadBool(L"LockInHome", LockInHome);
   Special = Storage->ReadBool(L"Special", Special);
   if (!Unsafe)
   {
@@ -1117,7 +1114,6 @@ void __fastcall TSessionData::DoSave(THierarchicalStorage * Storage,
     WRITE_DATA(Bool, ResolveSymlinks);
     WRITE_DATA(Bool, FollowDirectorySymlinks);
     WRITE_DATA_EX(Integer, L"ConsiderDST", DSTMode, );
-    WRITE_DATA(Bool, LockInHome);
     // Special is never stored (if it would, login dialog must be modified not to
     // duplicate Special parameter when Special session is loaded and then stored
     // under different name)
@@ -4067,11 +4063,6 @@ void __fastcall TSessionData::SetPostLoginCommands(UnicodeString value)
   SET_SESSION_PROPERTY(PostLoginCommands);
 }
 //---------------------------------------------------------------------
-void __fastcall TSessionData::SetLockInHome(bool value)
-{
-  SET_SESSION_PROPERTY(LockInHome);
-}
-//---------------------------------------------------------------------
 void __fastcall TSessionData::SetSpecial(bool value)
 {
   SET_SESSION_PROPERTY(Special);

+ 0 - 3
source/core/SessionData.h

@@ -139,7 +139,6 @@ private:
   UnicodeString FLocalDirectory;
   UnicodeString FRemoteDirectory;
   UnicodeString FOtherLocalDirectory;
-  bool FLockInHome;
   bool FSpecial;
   bool FSynchronizeBrowsing;
   bool FUpdateDirectories;
@@ -306,7 +305,6 @@ private:
   void __fastcall SetCacheDirectories(bool value);
   void __fastcall SetCacheDirectoryChanges(bool value);
   void __fastcall SetPreserveDirectoryChanges(bool value);
-  void __fastcall SetLockInHome(bool value);
   void __fastcall SetSpecial(bool value);
   UnicodeString __fastcall GetInfoTip();
   bool __fastcall GetDefaultShell();
@@ -594,7 +592,6 @@ public:
   __property bool CacheDirectories = { read=FCacheDirectories, write=SetCacheDirectories };
   __property bool CacheDirectoryChanges = { read=FCacheDirectoryChanges, write=SetCacheDirectoryChanges };
   __property bool PreserveDirectoryChanges = { read=FPreserveDirectoryChanges, write=SetPreserveDirectoryChanges };
-  __property bool LockInHome = { read=FLockInHome, write=SetLockInHome };
   __property bool Special = { read=FSpecial, write=SetSpecial };
   __property bool Selected  = { read=FSelected, write=FSelected };
   __property UnicodeString InfoTip  = { read=GetInfoTip };

+ 5 - 39
source/core/Terminal.cpp

@@ -1033,7 +1033,6 @@ __fastcall TTerminal::TTerminal(TSessionData * SessionData,
   FOperationProgressOnceDoneOperation = odoIdle;
 
   FUseBusyCursor = True;
-  FLockDirectory = L"";
   FDirectoryCache = new TRemoteDirectoryCache();
   FDirectoryChangesCache = NULL;
   FFSProtocol = cfsUnknown;
@@ -2327,26 +2326,6 @@ int __fastcall TTerminal::FileOperationLoop(TFileOperationEvent CallBackFunc,
   return Result;
 }
 //---------------------------------------------------------------------------
-UnicodeString __fastcall TTerminal::TranslateLockedPath(UnicodeString Path, bool Lock)
-{
-  if (SessionData->LockInHome && !Path.IsEmpty() && (Path[1] == L'/'))
-  {
-    if (Lock)
-    {
-      if (Path.SubString(1, FLockDirectory.Length()) == FLockDirectory)
-      {
-        Path.Delete(1, FLockDirectory.Length());
-        if (Path.IsEmpty()) Path = L"/";
-      }
-    }
-    else
-    {
-      Path = UnixExcludeTrailingBackslash(FLockDirectory + Path);
-    }
-  }
-  return Path;
-}
-//---------------------------------------------------------------------------
 void __fastcall TTerminal::ClearCaches()
 {
   FDirectoryCache->Clear();
@@ -2418,7 +2397,6 @@ TRemoteFileList * __fastcall TTerminal::DirectoryFileList(const UnicodeString Pa
 void __fastcall TTerminal::SetCurrentDirectory(UnicodeString value)
 {
   DebugAssert(FFileSystem);
-  value = TranslateLockedPath(value, false);
   if (value != FFileSystem->CurrentDirectory)
   {
     ChangeDirectory(value);
@@ -2440,8 +2418,7 @@ UnicodeString __fastcall TTerminal::GetCurrentDirectory()
     }
   }
 
-  UnicodeString Result = TranslateLockedPath(FCurrentDirectory, true);
-  return Result;
+  return FCurrentDirectory;
 }
 //---------------------------------------------------------------------------
 UnicodeString __fastcall TTerminal::PeekCurrentDirectory()
@@ -2451,8 +2428,7 @@ UnicodeString __fastcall TTerminal::PeekCurrentDirectory()
     FCurrentDirectory = FFileSystem->CurrentDirectory;
   }
 
-  UnicodeString Result = TranslateLockedPath(FCurrentDirectory, true);
-  return Result;
+  return FCurrentDirectory;
 }
 //---------------------------------------------------------------------------
 const TRemoteTokenList * __fastcall TTerminal::GetGroups()
@@ -3289,11 +3265,6 @@ void __fastcall TTerminal::ReadCurrentDirectory()
       FLastDirectoryChange = L"";
     }
 
-    if (OldDirectory.IsEmpty())
-    {
-      FLockDirectory = (SessionData->LockInHome ?
-        FFileSystem->CurrentDirectory : UnicodeString(L""));
-    }
     if (OldDirectory != FFileSystem->CurrentDirectory) DoChangeDirectory();
   }
   catch (Exception &E)
@@ -6696,10 +6667,6 @@ int __fastcall TTerminal::CopyToParallel(TParallelOperation * ParallelOperation,
     std::unique_ptr<TStrings> FilesToCopy(new TStringList());
     FilesToCopy->AddObject(FileName, Object);
 
-    if (ParallelOperation->Side == osLocal)
-    {
-      TargetDir = TranslateLockedPath(TargetDir, false);
-    }
     // OnceDoneOperation is not supported
     TOnceDoneOperation OnceDoneOperation = odoIdle;
 
@@ -6884,7 +6851,6 @@ bool __fastcall TTerminal::CopyToRemote(
         OperationProgress.SetTotalSize(Size);
       }
 
-      UnicodeString UnlockedTargetDir = TranslateLockedPath(TargetDir, false);
       BeginTransaction();
       try
       {
@@ -6894,13 +6860,13 @@ bool __fastcall TTerminal::CopyToRemote(
         if (Parallel)
         {
           // OnceDoneOperation is not supported
-          ParallelOperation->Init(Files.release(), UnlockedTargetDir, CopyParam, Params, &OperationProgress, Log->Name);
+          ParallelOperation->Init(Files.release(), TargetDir, CopyParam, Params, &OperationProgress, Log->Name);
           CopyParallel(ParallelOperation, &OperationProgress);
         }
         else
         {
-          FFileSystem->CopyToRemote(FilesToCopy, UnlockedTargetDir,
-            CopyParam, Params, &OperationProgress, OnceDoneOperation);
+          FFileSystem->CopyToRemote(
+            FilesToCopy, TargetDir, CopyParam, Params, &OperationProgress, OnceDoneOperation);
         }
 
         LogTotalTransferDone(&OperationProgress);

+ 0 - 4
source/core/Terminal.h

@@ -145,8 +145,6 @@ public:
   static const int spCaseSensitive = 0x2000;
   static const int spDefault = TTerminal::spNoConfirmation | TTerminal::spPreviewChanges;
 
-// for TranslateLockedPath()
-friend class TRemoteFile;
 // for ReactOnCommand()
 friend class TSCPFileSystem;
 friend class TSFTPFileSystem;
@@ -164,7 +162,6 @@ private:
   TActionLog * FActionLog;
   TConfiguration * FConfiguration;
   UnicodeString FCurrentDirectory;
-  UnicodeString FLockDirectory;
   Integer FExceptionOnFail;
   TRemoteDirectory * FFiles;
   int FInTransaction;
@@ -304,7 +301,6 @@ protected:
   bool __fastcall DeleteContentsIfDirectory(
     const UnicodeString & FileName, const TRemoteFile * File, int Params, TRmSessionAction & Action);
   void __fastcall AnnounceFileListOperation();
-  UnicodeString __fastcall TranslateLockedPath(UnicodeString Path, bool Lock);
   void __fastcall ReadDirectory(TRemoteFileList * FileList);
   void __fastcall CustomReadDirectory(TRemoteFileList * FileList);
   void __fastcall DoCreateLink(const UnicodeString FileName, const UnicodeString PointTo, bool Symbolic);