From a48aed634589403ac8c9052566af19d9657d62e4 Mon Sep 17 00:00:00 2001 From: Basile Burg Date: Wed, 17 Feb 2016 07:48:16 +0100 Subject: [PATCH] completed OSX port to be tested --- src/ce_common.pas | 22 ++++++++-------------- src/ce_dmdwrap.pas | 6 +++--- src/ce_dubproject.pas | 3 +-- src/ce_libman.pas | 28 ++++++++++++++++++++++------ src/ce_main.pas | 2 +- src/ce_miniexplorer.pas | 2 +- src/ce_nativeproject.pas | 2 +- 7 files changed, 37 insertions(+), 28 deletions(-) diff --git a/src/ce_common.pas b/src/ce_common.pas index 00e2fae0..50377d8d 100644 --- a/src/ce_common.pas +++ b/src/ce_common.pas @@ -9,8 +9,7 @@ uses Classes, SysUtils, {$IFDEF WINDOWS} Windows, JwaTlHelp32, - {$ENDIF} - {$IFDEF LINUX} + {$ELSE} ExtCtrls, FileUtil, LazFileUtils, {$ENDIF} {$IFNDEF CEBUILD} @@ -64,7 +63,7 @@ type * An idle timer is started when executing and trigs the event if necessary. *) TCheckedAsyncProcess = class(TAsyncProcess) - {$IFDEF LINUX} + {$IFNDEF WINDOWS} private fTimer: TIdleTimer; procedure checkTerminated(sender: TObject); @@ -377,7 +376,7 @@ begin exit(system.length(self)); end; -{$IFDEF LINUX} +{$IFNDEF WINDOWS} constructor TCheckedAsyncProcess.Create(aOwner: TComponent); begin inherited; @@ -521,13 +520,9 @@ begin end; begin result := aPath; - {$IFDEF MSWINDOWS} + {$IFDEF WINDOWS} result := patchProc(result, '/'); - {$ENDIF} - {$IFDEF UNIX} - result := patchProc(result, '\'); - {$ENDIF} - {$IFDEF DARWIN} + {$ELSE} result := patchProc(result, '\'); {$ENDIF} end; @@ -629,7 +624,7 @@ begin result := sysutils.GetEnvironmentVariable('HOME') + '/.config'; {$ENDIF} {$IFDEF DARWIN} - result := sysutils.GetEnvironmentVariable('HOME') + '/Library'; + result := sysutils.GetEnvironmentVariable('HOME') + '/Library/Application Support'; {$ENDIF} if not DirectoryExists(result) then raise Exception.Create('Coedit failed to retrieve the user data folder'); @@ -806,7 +801,6 @@ begin Free; end; {$ENDIF} - end; function exeInSysPath(anExeName: string): boolean; @@ -1159,13 +1153,13 @@ procedure deleteDups(str: TStrings); var i: integer; begin - {$HINTS OFF} + {$PUSH}{$HINTS OFF} if str = nil then exit; for i:= str.Count-1 downto 0 do // if less than 0 -> not found -> unsigned -> greater than current index. if cardinal(str.IndexOf(str[i])) < i then str.Delete(i); - {$HINTS ON} + {$POP} end; initialization diff --git a/src/ce_dmdwrap.pas b/src/ce_dmdwrap.pas index e12f1bac..ebaac05e 100644 --- a/src/ce_dmdwrap.pas +++ b/src/ce_dmdwrap.pas @@ -626,7 +626,7 @@ begin begin str := binKindStr[fBinKind]; if str.isNotEmpty then aList.Add(str); - {$IFDEF UNIX} + {$IFNDEF WINDOWS} if fBinKind = sharedlib then aList.Add('-fPIC'); {$ENDIF} @@ -659,7 +659,7 @@ begin if (str <> strbase) then begin aList.Add(str); - {$IFDEF UNIX} + {$IFNDEF WINDOWS} if fBinKind = sharedlib then aList.Add('-fPIC'); {$ENDIF} @@ -667,7 +667,7 @@ begin else begin aList.Add(strbase); - {$IFDEF UNIX} + {$IFNDEF WINDOWS} if baseopt.fBinKind = sharedlib then aList.Add('-fPIC'); {$ENDIF} diff --git a/src/ce_dubproject.pas b/src/ce_dubproject.pas index a4d728c6..0fb58c84 100644 --- a/src/ce_dubproject.pas +++ b/src/ce_dubproject.pas @@ -826,8 +826,7 @@ begin if conf.isNotNil then setFrom(conf); pathPart := TrimRightSet(pathPart, ['/','\']); - {$IFDEF WINDOWS} - {$ELSE} + {$IFNDEF WINDOWS} if fBinKind in [staticlib, sharedlib] then namePart := 'lib' + namePart; {$ENDIF} diff --git a/src/ce_libman.pas b/src/ce_libman.pas index cdcce512..ce06059a 100644 --- a/src/ce_libman.pas +++ b/src/ce_libman.pas @@ -111,15 +111,31 @@ begin end; {$ENDIF} {$IFDEF DARWIN} - assert(false, 'to be implemented'); + if '/Library/D/dmd/src/phobos'.dirExists then + begin + with TLibraryItem(fCol.Add) do begin + libAlias := 'phobos'; + libFile := ''; + libSourcePath := '/Library/D/dmd/src/phobos'; + end; + end; + // add druntime (no lib - only for DCD) + if '/Library/D/dmd/src/druntime/import'.dirExists then + begin + with TLibraryItem(fCol.Add) do begin + libAlias := 'druntime'; + libFile := ''; + libSourcePath := '/Library/D/dmd/src/druntime/import'; + end; + end; {$ENDIF} end; - if fCol.Count = 0 then + if (fCol.Count = 0) and not (getCoeditDocPath + libFname).fileExists then begin - dlgOkError( - 'Coedit failed to automatically add "druntime" and "phobos" to the library manager.' - + 'These two items have to be added manually following the procedure described in the wiki.' - ); + dlgOkInfo( + 'Coedit failed to add "druntime" and "phobos" to the library manager.' + + 'If they are not already specified in the DCD configuration then the ' + + 'completion will not work properly'); end; updateDCD; end; diff --git a/src/ce_main.pas b/src/ce_main.pas index 1ab0cb89..21d1b2ab 100644 --- a/src/ce_main.pas +++ b/src/ce_main.pas @@ -1937,7 +1937,7 @@ begin fRunProc.OnTerminate:= @asyncprocTerminate; end else begin - {$IFDEF LINUX} + {$IFNDEF WINDOWS} fRunProc.Options := fRunProc.Options + [poNewConsole]; {$ENDIF} end; diff --git a/src/ce_miniexplorer.pas b/src/ce_miniexplorer.pas index 5296c9e7..1bd2fd71 100644 --- a/src/ce_miniexplorer.pas +++ b/src/ce_miniexplorer.pas @@ -661,7 +661,7 @@ var str: string; begin result := false; - {$IFDEF LINUX} + {$IFNDEF WINDOWS} if (aPath.length >= 2) and (aPath[2] <> '/') then aPath := '/' + aPath; {$ENDIF} diff --git a/src/ce_nativeproject.pas b/src/ce_nativeproject.pas index 0189d284..25819a8e 100644 --- a/src/ce_nativeproject.pas +++ b/src/ce_nativeproject.pas @@ -150,7 +150,7 @@ begin subjProjNew(fProjectSubject, self); subjProjChanged(fProjectSubject, self); // - {$IFDEF LINUX} + {$IFNDEF WINDOWS} fBasePath := '/'; {$ENDIF} //