umaincommands.pas.patch (2,551 bytes)
Index: umaincommands.pas
===================================================================
--- umaincommands.pas (revision 7002)
+++ umaincommands.pas (working copy)
@@ -29,7 +29,7 @@
uses
Classes, SysUtils, ActnList, uFileView, uFileViewNotebook, uFileSourceOperation,
- uGlobs, uFileFunctions, uFormCommands, uFileSorting, uShellContextMenu, Menus, ufavoritetabs;
+ uGlobs, uFileFunctions, uFormCommands, uFileSorting, uShellContextMenu, Menus, ufavoritetabs,ufile;
type
@@ -45,6 +45,9 @@
FCommands: TFormCommands;
FOriginalNumberOfTabs: integer;
+ // Helper routines
+ procedure TryGetParentDir(FileView: TFileView; var SelectedFiles: TFiles);
+
// Filters out commands.
function CommandsFilter(Command: String): Boolean;
procedure OnCopyOutStateChanged(Operation: TFileSourceOperation;
@@ -346,7 +349,7 @@
fLinker, fSplitter, fDescrEdit, fCheckSumVerify, fCheckSumCalc, fSetFileProperties,
uLng, uLog, uShowMsg, uOSForms, uOSUtils, uDCUtils, uBriefFileView,
uShowForm, uShellExecute, uClipboard, uHash, uDisplayFile,
- uFilePanelSelect, uFile, uFileSystemFileSource, uQuickViewPanel,
+ uFilePanelSelect, uFileSystemFileSource, uQuickViewPanel,
uOperationsManager, uFileSourceOperationTypes, uWfxPluginFileSource,
uFileSystemDeleteOperation, uFileSourceExecuteOperation, uSearchResultFileSource,
uFileSourceOperationMessageBoxesUI, uFileSourceCalcChecksumOperation,
@@ -404,6 +407,24 @@
end;
//------------------------------------------------------
+procedure TMainCommands.TryGetParentDir(FileView: TFileView; var SelectedFiles: TFiles);
+var
+ activeFile : TFile;
+ tempPath : String;
+begin
+ activeFile := FileView.CloneActiveFile;
+ if assigned(activeFile) then begin
+ if activeFile.Name = '..' then
+ begin
+ tempPath := activeFile.FullPath;
+ activeFile.Name := ExtractFileName(ExcludeTrailingPathDelimiter(activeFile.Path));
+ activeFile.Path := ExpandFileName(tempPath);
+ SelectedFiles.Add(activeFile);
+ end
+ else
+ FreeAndNil(activeFile);
+ end;
+end;
procedure TMainCommands.OnCopyOutStateChanged(Operation: TFileSourceOperation;
State: TFileSourceOperationState);
@@ -594,6 +615,8 @@
PathToAdd, FileNameToAdd: String;
begin
SelectedFiles := FileView.CloneSelectedOrActiveFiles;
+ if (SelectedFiles.Count = 0) then
+ TryGetParentDir(FileView, SelectedFiles);
try
if SelectedFiles.Count > 0 then
begin