mirror of
https://github.com/ONLYOFFICE/desktop-apps.git
synced 2026-04-07 14:09:22 +08:00
[win-nix] refactoring
This commit is contained in:
@ -11,6 +11,7 @@
|
||||
#define sAppVerShort Copy(sAppVersion, 0, 3)
|
||||
|
||||
#include "associate_page.iss"
|
||||
#include "utils.iss"
|
||||
|
||||
|
||||
[Setup]
|
||||
@ -130,13 +131,6 @@ procedure GetSystemTimeAsFileTime(var lpFileTime: TFileTime); external 'GetSyste
|
||||
function SendTextMessageTimeout(hWnd: HWND; Msg: UINT; wParam: WPARAM; lParam: PAnsiChar; fuFlags: UINT; uTimeout: UINT; out lpdwResult: DWORD): LRESULT;
|
||||
external 'SendMessageTimeoutA@user32.dll stdcall';
|
||||
|
||||
function GetCommandlineParam(inParamName: String):String; forward;
|
||||
function CheckCommandlineParam(inpn: String) : Boolean; forward;
|
||||
function StartsWith(SubStr, S: String) : Boolean; forward;
|
||||
function StringReplace(S, oldSubString, newSubString: String) : String; forward;
|
||||
|
||||
procedure DirectoryCopy(SourcePath, DestPath: string); forward;
|
||||
|
||||
//procedure checkArchitectureVersion; forward;
|
||||
function GetHKLM: Integer; forward;
|
||||
|
||||
@ -419,89 +413,6 @@ begin
|
||||
SendTextMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, 0, PAnsiChar(S), SMTO_ABORTIFHUNG, 5000, MsgResult);
|
||||
end;
|
||||
|
||||
procedure DirectoryCopy(SourcePath, DestPath: string);
|
||||
var
|
||||
FindRec: TFindRec;
|
||||
SourceFilePath: string;
|
||||
DestFilePath: string;
|
||||
begin
|
||||
if FindFirst(SourcePath + '\*', FindRec) then
|
||||
begin
|
||||
try
|
||||
repeat
|
||||
if (FindRec.Name <> '.') and (FindRec.Name <> '..') then
|
||||
begin
|
||||
SourceFilePath := SourcePath + '\' + FindRec.Name;
|
||||
DestFilePath := DestPath + '\' + FindRec.Name;
|
||||
if FindRec.Attributes and FILE_ATTRIBUTE_DIRECTORY = 0 then
|
||||
begin
|
||||
if not FileCopy(SourceFilePath, DestFilePath, False) then
|
||||
Log(Format('Failed to copy %s to %s', [SourceFilePath, DestFilePath]));
|
||||
end else
|
||||
begin
|
||||
if DirExists(DestFilePath) or CreateDir(DestFilePath) then
|
||||
begin
|
||||
DirectoryCopy(SourceFilePath, DestFilePath);
|
||||
end else
|
||||
Log(Format('Failed to create %s', [DestFilePath]));
|
||||
end;
|
||||
end;
|
||||
until not FindNext(FindRec);
|
||||
finally
|
||||
FindClose(FindRec);
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
Log(Format('Failed to list %s', [SourcePath]));
|
||||
end;
|
||||
end;
|
||||
|
||||
function StartsWith(SubStr, S: String) : Boolean;
|
||||
begin
|
||||
Result := Pos(SubStr, S) = 1;
|
||||
end;
|
||||
|
||||
function StringReplace(S, oldSubString, newSubString: String) : String;
|
||||
var
|
||||
stringCopy : String;
|
||||
begin
|
||||
stringCopy := S; //Prevent modification to the original string
|
||||
StringChange(stringCopy, oldSubString, newSubString);
|
||||
Result := stringCopy;
|
||||
end;
|
||||
|
||||
function GetCommandlineParam(inParamName: String) : String;
|
||||
var
|
||||
paramNameAndValue: String;
|
||||
i: Integer;
|
||||
begin
|
||||
Result := '';
|
||||
|
||||
for i:= 1 to ParamCount do
|
||||
begin
|
||||
paramNameAndValue := Lowercase(ParamStr(i));
|
||||
if StartsWith(inParamName, paramNameAndValue) then
|
||||
begin
|
||||
Result := StringReplace(paramNameAndValue, inParamName + ':', '');
|
||||
break;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
function CheckCommandlineParam(inpn: String) : Boolean;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
Result := false;
|
||||
|
||||
for i:= 1 to ParamCount do begin
|
||||
if inpn = Lowercase(ParamStr(i)) then begin
|
||||
Result := true;
|
||||
break;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
[Dirs]
|
||||
Name: {commonappdata}\{#APP_PATH}\webdata\cloud; Flags: uninsalwaysuninstall;
|
||||
|
||||
@ -526,6 +437,12 @@ Source: ..\..\..\..\core\build\jsdesktop\sdkjs\*; DestDir: {app}\e
|
||||
Source: ..\..\..\..\core\build\empty\*; DestDir: {app}\converter\empty;
|
||||
Source: ..\..\..\common\converter\DoctRenderer.config; DestDir: {app}\converter;
|
||||
|
||||
Source: ..\..\..\..\core\build\lib\{#os_arch}\*; DestDir: {app}\converter;
|
||||
Excludes: *.lib,HtmlFileInternal.exe,ascdocumentscore.dll,ooxmlsignature.dll; Flags: ignoreversion;
|
||||
Source: ..\..\..\..\core\build\lib\{#os_arch}\HtmlFileInternal.exe; DestDir: {app}\; Flags: ignoreversion;
|
||||
Source: ..\..\..\..\core\build\lib\{#os_arch}\ascdocumentscore.dll; DestDir: {app}\; Flags: ignoreversion;
|
||||
Source: ..\..\..\..\core\build\lib\{#os_arch}\ooxmlsignature.dll; DestDir: {app}\; Flags: ignoreversion;
|
||||
|
||||
Source: ..\..\..\common\package\fonts\LICENSE.txt; DestDir: {app}\fonts;
|
||||
Source: ..\..\..\common\package\fonts\OpenSans-Bold.ttf; DestDir: {app}\fonts; Flags: onlyifdoesntexist;
|
||||
Source: ..\..\..\common\package\fonts\OpenSans-Regular.ttf; DestDir: {app}\fonts; Flags: onlyifdoesntexist;
|
||||
|
||||
@ -21,9 +21,6 @@ Source: data\vcredist\vcredist_x64.exe; DestDir: {app}\; Flags: deleteafte
|
||||
Source: ..\..\..\..\core\build\bin\win_64\x2t.exe; DestDir: {app}\converter; Flags: ignoreversion;
|
||||
Source: ..\..\..\..\core\build\bin\win_64\icudt.dll; DestDir: {app}\converter; Flags: ignoreversion;
|
||||
Source: ..\..\..\..\core\build\bin\icu\{#os_arch}\*; DestDir: {app}\converter; Flags: ignoreversion; Excludes: *.lib;
|
||||
Source: ..\..\..\..\core\build\lib\{#os_arch}\*; DestDir: {app}\converter; Excludes: *.lib,HtmlFileInternal.exe,ascdocumentscore.dll; Flags: ignoreversion;
|
||||
Source: ..\..\..\..\core\build\lib\{#os_arch}\HtmlFileInternal.exe; DestDir: {app}\; Flags: ignoreversion;
|
||||
Source: ..\..\..\..\core\build\lib\{#os_arch}\ascdocumentscore.dll; DestDir: {app}\; Flags: ignoreversion;
|
||||
|
||||
Source: ..\..\..\..\core\build\cef\{#os_arch}\*; DestDir: {app}\; Excludes: *.lib; Flags: ignoreversion recursesubdirs;
|
||||
Source: data\libs\qt\win64\*; DestDir: {app}\; Flags: ignoreversion recursesubdirs;
|
||||
|
||||
@ -15,9 +15,6 @@ Source: data\vcredist\vcredist_x86.exe; DestDir: {app}\; Flags: deleteafte
|
||||
Source: ..\..\..\..\core\build\bin\win_32\x2t.exe; DestDir: {app}\converter; Flags: ignoreversion;
|
||||
Source: ..\..\..\..\core\build\bin\win_32\icudt.dll; DestDir: {app}\converter; Flags: ignoreversion;
|
||||
Source: ..\..\..\..\core\build\bin\icu\{#os_arch}\*; DestDir: {app}\converter; Flags: ignoreversion; Excludes: *.lib;
|
||||
Source: ..\..\..\..\core\build\lib\{#os_arch}\*; DestDir: {app}\converter; Excludes: *.lib,HtmlFileInternal.exe,ascdocumentscore.dll; Flags: ignoreversion;
|
||||
Source: ..\..\..\..\core\build\lib\{#os_arch}\HtmlFileInternal.exe; DestDir: {app}\; Flags: ignoreversion;
|
||||
Source: ..\..\..\..\core\build\lib\{#os_arch}\ascdocumentscore.dll; DestDir: {app}\; Flags: ignoreversion;
|
||||
|
||||
Source: ..\..\..\..\core\build\cef\{#os_arch}\*; DestDir: {app}\; Excludes: *.lib; Flags: ignoreversion recursesubdirs;
|
||||
Source: data\libs\qt\win32\*; DestDir: {app}\; Flags: ignoreversion recursesubdirs;
|
||||
|
||||
77
win-linux/package/windows/utils.iss
Normal file
77
win-linux/package/windows/utils.iss
Normal file
@ -0,0 +1,77 @@
|
||||
|
||||
[Code]
|
||||
|
||||
procedure DirectoryCopy(SourcePath, DestPath: string);
|
||||
var
|
||||
FindRec: TFindRec;
|
||||
SourceFilePath: string;
|
||||
DestFilePath: string;
|
||||
begin
|
||||
if FindFirst(SourcePath + '\*', FindRec) then begin
|
||||
try
|
||||
repeat
|
||||
if (FindRec.Name <> '.') and (FindRec.Name <> '..') then begin
|
||||
SourceFilePath := SourcePath + '\' + FindRec.Name;
|
||||
DestFilePath := DestPath + '\' + FindRec.Name;
|
||||
if FindRec.Attributes and FILE_ATTRIBUTE_DIRECTORY = 0 then begin
|
||||
if not FileCopy(SourceFilePath, DestFilePath, False) then
|
||||
Log(Format('Failed to copy %s to %s', [SourceFilePath, DestFilePath]));
|
||||
end else begin
|
||||
if DirExists(DestFilePath) or CreateDir(DestFilePath) then begin
|
||||
DirectoryCopy(SourceFilePath, DestFilePath);
|
||||
end else
|
||||
Log(Format('Failed to create %s', [DestFilePath]));
|
||||
end;
|
||||
end;
|
||||
until not FindNext(FindRec);
|
||||
finally
|
||||
FindClose(FindRec);
|
||||
end;
|
||||
end else begin
|
||||
Log(Format('Failed to list %s', [SourcePath]));
|
||||
end;
|
||||
end;
|
||||
|
||||
function StartsWith(SubStr, S: String): Boolean;
|
||||
begin
|
||||
Result := Pos(SubStr, S) = 1;
|
||||
end;
|
||||
|
||||
function StringReplace(S, oldSubString, newSubString: String) : String;
|
||||
var
|
||||
stringCopy : String;
|
||||
begin
|
||||
stringCopy := S; //Prevent modification to the original string
|
||||
StringChange(stringCopy, oldSubString, newSubString);
|
||||
Result := stringCopy;
|
||||
end;
|
||||
|
||||
function GetCommandlineParam(inParamName: String) : String;
|
||||
var
|
||||
paramNameAndValue: String;
|
||||
i: Integer;
|
||||
begin
|
||||
Result := '';
|
||||
|
||||
for i:= 1 to ParamCount do begin
|
||||
paramNameAndValue := Lowercase(ParamStr(i));
|
||||
if StartsWith(inParamName, paramNameAndValue) then begin
|
||||
Result := StringReplace(paramNameAndValue, inParamName + ':', '');
|
||||
break;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
function CheckCommandlineParam(inpn: String) : Boolean;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
Result := false;
|
||||
|
||||
for i:= 1 to ParamCount do begin
|
||||
if inpn = Lowercase(ParamStr(i)) then begin
|
||||
Result := true;
|
||||
break;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
Reference in New Issue
Block a user