diff options
Diffstat (limited to 'UMain.pas')
| -rw-r--r-- | UMain.pas | 49 |
1 files changed, 28 insertions, 21 deletions
@@ -1658,7 +1658,7 @@ begin RightPathLabelEventBox.ControlState := csSelected; s := RightPathLabel.Caption; end; - CommandLineLabel.Caption := Format('%s@%s:%s>', [GetUserName, GetHostName, s]); + CommandLineLabel.Caption := Format('%s@%s:%s>', [GetUserName, String(g_get_host_name()), s]); UpdateCaption; miDisconnect.Enabled := (LeftLastFocused and (LeftPanelEngine is TVFSEngine) and (not TVFSEngine(LeftPanelEngine).ArchiveMode)) or ((not LeftLastFocused) and (RightPanelEngine is TVFSEngine) and (not TVFSEngine(RightPanelEngine).ArchiveMode)); @@ -1936,7 +1936,7 @@ begin RightPathLabel.UseMarkup := True; if LeftLastFocused then s := LeftPathLabel.Caption else s := RightPathLabel.Caption; - CommandLineLabel.Caption := Format('%s@%s:%s>', [GetUserName, GetHostName, s]); + CommandLineLabel.Caption := Format('%s@%s:%s>', [GetUserName, String(g_get_host_name()), s]); LeftPanelEngine.GetFileSystemInfo(LeftPanelEngine.Path, FSSize, FSFree, FSName); // *TODO: hide numbers if filesystem info cannot be determined if FSSize < 0 then FSSize := 0; @@ -3432,8 +3432,9 @@ end; procedure TFMain.EditViewFileInternal(Filename: string; Engine: TPanelEngine; View, NewFile: boolean); var s: string; + Error: string; Stat: PDataItem; - Error, x: integer; + x: integer; // AViewer: TViewerThread; AViewer: TFViewer; begin @@ -3469,7 +3470,7 @@ begin if View then x := ConfViewerTerminalBehaviour else x := ConfEditorTerminalBehaviour; if not ExecuteProgram(Format('%s %s', [s, QuoteStr(Filename)]), ExtractFilePath(Filename), x = 0, x = 1, Error) then - Application.MessageBox(Format(LANGCannotExecuteSPleaseCheckTheConfiguration, [s]), [mbOK], mbError, mbNone, mbOK); + Application.MessageBox(Format(LANGCannotExecuteSPleaseCheckTheConfiguration + #10#10'%s', [s, StrToUTF8(Error)]), [mbOK], mbError, mbNone, mbOK); end; end; @@ -3506,6 +3507,7 @@ end; procedure TFMain.RunFile(Path: string; Engine: TPanelEngine; CustomAction: integer); var Command, FileTypeDesc: string; + Error: string; i, ac: integer; b, AutodetectGUI, RunInTerminal: boolean; Stat: PDataItem; @@ -3516,9 +3518,10 @@ begin InternalLock; Command := ''; FileTypeDesc := ''; + Error := ''; AutodetectGUI := True; RunInTerminal := False; - + Assoc := FindAssoc(ExtractFileName(Path)); if Assoc <> nil then begin FileTypeDesc := Assoc.FileTypeName; @@ -3546,7 +3549,7 @@ begin if Engine is TVFSEngine then b := HandleRunFromArchive(Path, Engine, Command, FileTypeDesc, False); // not a local engine, extract to local first if b then begin libc_chdir(PChar(ExtractFilePath(Path))); - b := ExecuteProgram(QuoteStr(Path), ExtractFilePath(Path), AutodetectGUI, RunInTerminal, i); + b := ExecuteProgram(QuoteStr(Path), ExtractFilePath(Path), AutodetectGUI, RunInTerminal, Error); libc_chdir(PChar('/')); end else b := True; // Mask cancelled extraction from VFS FreeDataItem(Stat); @@ -3570,11 +3573,11 @@ begin // DebugMsg(['execute: ', s, ' , ', Command, ' , ', QuoteStr(Path)]); if b then begin libc_chdir(PChar(ExtractFilePath(Path))); - b := ExecuteProgram(s, ExtractFilePath(Path), AutodetectGUI, RunInTerminal, i); + b := ExecuteProgram(s, ExtractFilePath(Path), AutodetectGUI, RunInTerminal, Error); libc_chdir(PChar('/')); end else b := True; // Mask cancelled extraction from VFS end; - if not b then Application.MessageBox(Format(LANGCannotExecuteSPleaseCheckTheConfiguration, [s]), [mbOK], mbError, mbNone, mbOK); + if not b then Application.MessageBox(Format(LANGCannotExecuteSPleaseCheckTheConfiguration + #10#10'%s', [s, StrToUTF8(Error)]), [mbOK], mbError, mbNone, mbOK); finally Application.ProcessMessages; InternalUnLock; @@ -3582,10 +3585,11 @@ begin end; procedure TFMain.CommandLineComboKeyDown(Sender: TObject; Key: Word; Shift: TShiftState; var Accept: boolean); -var Error, OldPos, i: integer; +var OldPos, i: integer; AListView: TGTKListView; Engine: TPanelEngine; s, s2, Orig: string; + Error: string; begin try InternalLock; @@ -3626,7 +3630,7 @@ begin while not (Engine is TLocalTreeEngine) do Engine := Engine.ParentEngine; libc_chdir(PChar(Engine.Path)); if not ExecuteProgram(UTF8ToStr(Orig), Engine.Path, ConfCmdLineTerminalBehaviour = 0 , ConfCmdLineTerminalBehaviour = 1, Error) then - Application.MessageBox(LANGErrorExecutingCommand, [mbOK], mbError, mbNone, mbOK); + Application.MessageBox(LANGErrorExecutingCommand + Format(#10#10'%s', [StrToUTF8(Error)]), [mbOK], mbError, mbNone, mbOK); libc_chdir('/'); end; end; @@ -4180,12 +4184,13 @@ var Engine: TPanelEngine; DataItem: PDataItem; AListView: TGTKListView; FileName, ShortFName, s: string; - SpawnError: integer; + SpawnError: string; Error: PGError; b: boolean; begin try InternalLock; + SpawnError := ''; if (not Assigned(Sender)) or (not (Sender is TGTKMenuItem)) then begin DebugMsg(['Error: Popup menuitem is invalid']); end; @@ -4220,7 +4225,7 @@ begin b := ExecuteProgram(QuoteStr(FileName), ExtractFilePath(FileName), True, False, SpawnError); libc_chdir(PChar('/')); end else b := True; // Mask cancelled extraction from VFS - if not b then Application.MessageBox(LANGErrorExecutingCommand, [mbOK], mbError, mbNone, mbOK); + if not b then Application.MessageBox(LANGErrorExecutingCommand + Format(#10#10'%s', [StrToUTF8(SpawnError)]), [mbOK], mbError, mbNone, mbOK); end; 2: if Application.MessageBox(Format(LANGThereIsNoApplicationAssociatedWithS, [ShortFName]), [mbYes, mbNo], mbQuestion, mbNone, mbNo) = mbYes then miFileTypesClick(Self); @@ -4237,7 +4242,7 @@ begin TAssocAction((Sender as TGTKMenuItem).Data).RunInTerminal, SpawnError); libc_chdir(PChar('/')); end else b := True; // Mask cancelled extraction from VFS - if not b then Application.MessageBox(Format(LANGCannotExecuteSPleaseCheckTheConfiguration, [FileName]), [mbOK], mbError, mbNone, mbOK); + if not b then Application.MessageBox(Format(LANGCannotExecuteSPleaseCheckTheConfiguration + #10#10'%s', [FileName, StrToUTF8(SpawnError)]), [mbOK], mbError, mbNone, mbOK); end; end; FreeDataItem(DataItem); @@ -6027,15 +6032,17 @@ end; procedure TFMain.OpenTerminalButtonClick(Sender: TObject); var CurrentPath: string; AEngine: TPanelEngine; - Error: integer; + Error: string; + s: string; begin - Error := 0; if LeftLastFocused then AEngine := LeftPanelEngine else AEngine := RightPanelEngine; while not (AEngine is TLocalTreeEngine) do AEngine := AEngine.ParentEngine; CurrentPath := AEngine.Path; libc_chdir(PChar(CurrentPath)); - ExecuteProgram('bash', CurrentPath, False, True, Error); + s := 'bash'; + if not ExecuteProgram(s, CurrentPath, False, True, Error) then + Application.MessageBox(Format(LANGCannotExecuteSPleaseCheckTheConfiguration + #10#10'%s', [s, StrToUTF8(Error)]), [mbOK], mbError, mbNone, mbOK); libc_chdir('/'); end; @@ -6187,7 +6194,7 @@ var s: string; begin s := IncludeTrailingPathDelimiter(ConfTempPath) + 'tuxcmd-XXXXXX'; tmp := strdup(PChar(s)); - tmp := mkdtemp(tmp); + tmp := g_mkdtemp(tmp); if tmp = nil then begin err := errno; DebugMsg(['(EE) ExtractFromArchive: Couldn''t create temporary directory: ', strerror(err)]); @@ -6276,7 +6283,7 @@ var LeftPanel: boolean; SourceListView, TargetListView: TGTKListView; SourceEngine, TargetEngine: TPanelEngine; SourceFile, TargetFile: string; - Error: integer; + Error: string; begin if LeftListView.Focused then LeftPanel := True else if RightListView.Focused then LeftPanel := False else @@ -6313,7 +6320,7 @@ begin if not HandleRunFromArchive(TargetFile, TargetEngine, '', '', True) then Exit; if not ExecuteProgram(Format('%s %s %s', [ConfDiffCommand, QuoteStr(SourceFile), QuoteStr(TargetFile)]), SourceEngine.Path, ConfDiffTerminalBehaviour = 0, ConfDiffTerminalBehaviour = 1, Error) then - Application.MessageBox(Format(LANGCannotExecuteSPleaseCheckTheConfiguration, [ConfDiffCommand]), [mbOK], mbError, mbNone, mbOK); + Application.MessageBox(Format(LANGCannotExecuteSPleaseCheckTheConfiguration + #10#10'%s', [ConfDiffCommand, StrToUTF8(Error)]), [mbOK], mbError, mbNone, mbOK); end; procedure TFMain.miSynchronizeDirsClick(Sender: TObject); @@ -6321,7 +6328,7 @@ var LeftPanel: boolean; SourceListView, TargetListView: TGTKListView; SourceEngine, TargetEngine: TPanelEngine; SourceDir, TargetDir: string; - Error: integer; + Error: string; begin if LeftListView.Focused then LeftPanel := True else if RightListView.Focused then LeftPanel := False else @@ -6366,7 +6373,7 @@ begin if not HandleRunFromArchive(TargetDir, TargetEngine, '', '', True) then Exit; if not ExecuteProgram(Format('%s %s %s', [ConfDiffDirCommand, QuoteStr(SourceDir), QuoteStr(TargetDir)]), SourceEngine.Path, ConfDiffDirTerminalBehaviour = 0, ConfDiffDirTerminalBehaviour = 1, Error) then - Application.MessageBox(Format(LANGCannotExecuteSPleaseCheckTheConfiguration, [ConfDiffDirCommand]), [mbOK], mbError, mbNone, mbOK); + Application.MessageBox(Format(LANGCannotExecuteSPleaseCheckTheConfiguration + #10#10'%s', [ConfDiffDirCommand, StrToUTF8(Error)]), [mbOK], mbError, mbNone, mbOK); end; |
