Skip to content

Commit 95df174

Browse files
committed
chore: remove Wine hacks, now that we provide native Linux builds
1 parent 5e2c8b5 commit 95df174

File tree

6 files changed

+22
-78
lines changed

6 files changed

+22
-78
lines changed

source/apphelpers.pas

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -419,8 +419,6 @@ TAppSettings = class(TObject)
419419
function ProcessExists(pid: Cardinal; ExeNamePattern: String): Boolean;
420420
function SynCompletionProposalPrettyText(ImageIndex: Integer; LeftText, CenterText, RightText: String; LeftColor: TColor=-1; CenterColor: TColor=-1; RightColor: TColor=-1): String;
421421
function PopupComponent(Sender: TObject): TComponent;
422-
function IsWine: Boolean;
423-
function DirSep: Char;
424422
procedure FindComponentInstances(BaseForm: TComponent; ClassType: TClass; var List: TObjectList<TComponent>);
425423
function GetOS: String;
426424
function UserAgent(OwnerComponent: TComponent): String;
@@ -444,7 +442,6 @@ TAppSettings = class(TObject)
444442
LibHandleUser32: THandle;
445443
UTF8NoBOMEncoding: TUTF8NoBOMEncoding;
446444
DateTimeNever: TDateTime;
447-
IsWineStored: Integer = -1;
448445

449446
implementation
450447

@@ -2850,39 +2847,6 @@ function PopupComponent(Sender: TObject): TComponent;
28502847
Result := (Menu as TPopupMenu).PopupComponent;
28512848
end;
28522849

2853-
2854-
function IsWine: Boolean;
2855-
{$IfDef WINDOWS}
2856-
var
2857-
NTHandle: THandle;
2858-
wine_nt_to_unix_file_name: procedure(p1:pointer; p2:pointer); stdcall;
2859-
{$EndIf}
2860-
begin
2861-
{$IfDef WINDOWS}
2862-
// Detect if we're running on Wine, not on native Windows
2863-
// Idea taken from http://ruminatedrumblings.blogspot.com/2008/04/detecting-virtualized-environment.html
2864-
if IsWineStored = -1 then begin
2865-
NTHandle := LoadLibrary('NTDLL.DLL');
2866-
if NTHandle>32 then
2867-
wine_nt_to_unix_file_name := GetProcAddress(NTHandle, 'wine_nt_to_unix_file_name')
2868-
else
2869-
wine_nt_to_unix_file_name := nil;
2870-
IsWineStored := IfThen(Assigned(wine_nt_to_unix_file_name), 1, 0);
2871-
FreeLibrary(NTHandle);
2872-
end;
2873-
{$EndIf}
2874-
{$IfDef UNIX}
2875-
IsWineStored := 0;
2876-
{$EndIf}
2877-
Result := IsWineStored = 1;
2878-
end;
2879-
2880-
2881-
function DirSep: Char;
2882-
begin
2883-
Result := DirectorySeparator;
2884-
end;
2885-
28862850
procedure FindComponentInstances(BaseForm: TComponent; ClassType: TClass; var List: TObjectList<TComponent>);
28872851
var
28882852
i: Integer;

source/grideditlinks.pas

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,8 +350,7 @@ function TBaseGridEditorLink.PrepareEdit(Tree: TBaseVirtualTree; Node: PVirtualN
350350
end;
351351
// Adjust editor position and allow repainting mainform
352352
SetBounds(FCellTextBounds);
353-
if not IsWine then
354-
FParentForm.Repaint;
353+
FParentForm.Repaint;
355354
end;
356355

357356
function TBaseGridEditorLink.BeginEdit: Boolean;

source/loaddata.pas

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ procedure Tloaddataform.ServerParse(Sender: TObject);
390390
SQL := SQL + 'LOW_PRIORITY ';
391391

392392
// Issue #1387: Use 8.3 filename, to prevent "file not found" error from MySQL library
393-
// Todo: test on Wine
393+
// Todo: test on non-Windows
394394
Filename := ExtractShortPathName(editFilename.Text);
395395
if not Filename.IsEmpty then
396396
MainForm.LogSQL('Converting filename to 8.3 format: '+editFilename.Text+' => '+Filename, lcInfo)

source/main.pas

Lines changed: 16 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1443,7 +1443,7 @@ procedure TMainForm.ShowStatusMsg(Msg: String=''; PanelNr: Integer=6);
14431443
Msg := _(SIdle);
14441444
if Msg <> StatusBar.Panels[PanelNr].Text then begin
14451445
StatusBar.Panels[PanelNr].Text := Msg;
1446-
if (PanelNr = 6) and (not IsWine) then begin
1446+
if PanelNr = 6 then begin
14471447
// Immediately repaint this special panel, as it holds critical update messages,
14481448
// while avoiding StatusBar.Repaint which refreshes all panels
14491449
// Caution: statusbar.Repaint crashes with QT here. See issue #2270
@@ -1460,9 +1460,6 @@ procedure TMainForm.StatusBarClick(Sender: TObject);
14601460
PanelRect: TRect;
14611461
begin
14621462
// Handle click events on specific statusbar panels
1463-
// Prevent SendMessage on Wine
1464-
if IsWine then
1465-
Exit;
14661463
Click := StatusBar.ScreenToClient(Mouse.CursorPos);
14671464
for i:=0 to StatusBar.Panels.Count-1 do begin
14681465
PanelRect := StatusBar.ClientRect;
@@ -2203,11 +2200,11 @@ procedure TMainForm.AfterFormCreate;
22032200
LastStatsCall := StrToDateTimeDef(AppSettings.ReadString(asLastUsageStatisticCall), DateTimeNever);
22042201
if DaysBetween(Now, LastStatsCall) >= 30 then begin
22052202
// Report used app version, bits.
2206-
// Also report environment: WinDesktop, WinUWP or Wine
2203+
// Also report environment = OS + "Desktop" (+ "Portable")
22072204

2208-
if IsWine then Environment := 'Wine'
2209-
else if AppSettings.PortableMode then Environment := 'WinDesktopPortable'
2210-
else Environment := GetOS + 'Desktop';
2205+
Environment := GetOS + 'Desktop';
2206+
if AppSettings.PortableMode then
2207+
Environment := Environment + 'Portable';
22112208

22122209
StatsCall := THttpDownload.Create(Self);
22132210
StatsURL := APPDOMAIN + 'savestats.php?c=' + IntToStr(FAppVerRevision) +
@@ -3851,34 +3848,27 @@ procedure TMainForm.actDropObjectsExecute(Sender: TObject);
38513848
procedure TMainForm.actLaunchCommandlineExecute(Sender: TObject);
38523849
var
38533850
path, p, log, cmd: String;
3854-
sep: Char;
38553851
Conn: TDBConnection;
38563852
begin
38573853
// Launch mysql.exe
38583854
Conn := ActiveConnection;
38593855
if not Conn.Parameters.IsAnyMySQL then
38603856
ErrorDialog(_('Command line only works on MySQL connections.'))
38613857
else begin
3862-
if IsWine then begin
3863-
cmd := 'mysql';
3864-
sep := '/';
3865-
end else begin
3866-
cmd := 'mysql.exe';
3867-
sep := '\';
3868-
end;
3858+
cmd := 'mysql' {$IFDEF WINDOWS}+ '.exe'{$ENDIF};
38693859
path := AppSettings.ReadString(asMySQLBinaries);
3870-
if (Length(path)>0) and (path[Length(path)] <> sep) then
3871-
path := path + sep;
3860+
if not path.IsEmpty then
3861+
path := IncludeTrailingPathDelimiter(path);
38723862
if not FileExists(path+cmd, true) then begin
38733863
ErrorDialog(f_('You need to tell %s where your MySQL binaries reside, in %s > %s > %s.', [APPNAME, _('Tools'), _('Preferences'), _('General')])+
38743864
CRLF+CRLF+f_('Current setting is: "%s"', [path]));
38753865
end else begin
38763866
p := '';
3877-
if IsWine then begin
3878-
p := ' -e '+path+cmd;
3879-
path := '';
3880-
cmd := '$TERM';
3881-
end;
3867+
{$IFNDEF WINDOWS}
3868+
p := ' -e '+path+cmd;
3869+
path := '';
3870+
cmd := '$TERM';
3871+
{$ENDIF}
38823872

38833873
log := path + cmd + p + Conn.Parameters.GetExternalCliArguments(Conn, nbTrue);
38843874
LogSQL(f_('Launching command line: %s', [log]), lcInfo);
@@ -5812,10 +5802,10 @@ procedure TMainForm.AnyGridAdvancedHeaderDraw(Sender: TVTHeader;
58125802
if ColSortDirection = sdAscending then begin
58135803
// This is a bit wrong - but the "Ubuntu" font doesn't have the triangle character,
58145804
// which seems available on many Windows fonts only. See #1090
5815-
SortText := IfThen(IsWine, '↑', '▲');
5805+
SortText := {$IFDEF LINUX} '↑' {$ELSE} '▲' {$ENDIF};
58165806
NumCharTop := 0;
58175807
end else begin
5818-
SortText := IfThen(IsWine, '↓', '▼');
5808+
SortText := {$IFDEF LINUX} '↓' {$ELSE} '▼' {$ENDIF};
58195809
NumCharTop := 5;
58205810
end;
58215811
// Paint arrow:
@@ -8846,10 +8836,6 @@ procedure TMainForm.AnyGridGetHint(Sender: TBaseVirtualTree; Node:
88468836
Conn: TDBConnection;
88478837
ValIsNumber: Boolean;
88488838
begin
8849-
// Disable tooltips on Wine, as they prevent users from clicking + editing clipped cells
8850-
if IsWine then
8851-
Exit;
8852-
88538839
Tree := TVirtualStringTree(Sender);
88548840

88558841
if Tree = QueryTabs.ActiveHelpersTree then begin
@@ -14799,7 +14785,7 @@ procedure TMainForm.EnableProgress(MaxValue: Integer);
1479914785
begin
1480014786
// Initialize progres bar and button
1480114787
SetProgressState(pbsNormal);
14802-
ProgressBarStatus.Visible := True and (not IsWine);
14788+
ProgressBarStatus.Visible := True;
1480314789
SetProgressPosition(0);
1480414790
ProgressBarStatus.Max := MaxValue;
1480514791
end;

source/preferences.pas

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -541,12 +541,7 @@ procedure TfrmPreferences.FormCreate(Sender: TObject);
541541
Width := AppSettings.ReadInt(asPreferencesWindowWidth);
542542
Height := AppSettings.ReadInt(asPreferencesWindowHeight);
543543

544-
// Misecllaneous
545-
// Hide browse button on Wine, as the browse dialog returns Windows-style paths, while we need a Unix path
546-
if IsWine then begin
547-
editMySQLBinaries.Button.Enabled := False;
548-
editMySQLBinaries.OnDblClick := nil;
549-
end;
544+
// Miscellaneous
550545

551546
InitLanguages;
552547
comboAppLanguage.Items.AddStrings(FLanguages);

source/tabletools.pas

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -479,9 +479,9 @@ procedure TfrmTableTools.menuCopyMysqldumpCommandClick(Sender: TObject);
479479
Conn := MainForm.ActiveConnection;
480480

481481
BinPath := AppSettings.ReadString(asMySQLBinaries);
482-
if (not BinPath.IsEmpty) and (BinPath[Length(BinPath)] <> DirSep) then
483-
BinPath := BinPath + DirSep;
484-
BinPath := BinPath + IfThen(IsWine, 'mysqldump', 'mysqldump.exe');
482+
if not BinPath.IsEmpty then
483+
BinPath := IncludeTrailingPathDelimiter(BinPath);
484+
BinPath := BinPath + 'mysqldump' {$IFDEF WINDOWS} + '.exe' {$ENDIF};
485485

486486
ConnectionArguments := Conn.Parameters.GetExternalCliArguments(nil, nbUnset);
487487

0 commit comments

Comments
 (0)