You've already forked lazarus-ccr
Work-in-progress.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5720 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -10,7 +10,7 @@
|
||||
<IsPartOfProject Value="True"/>
|
||||
<EditorIndex Value="8"/>
|
||||
<CursorPos X="25" Y="28"/>
|
||||
<UsageCount Value="67"/>
|
||||
<UsageCount Value="94"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
@ -21,7 +21,7 @@
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<TopLine Value="208"/>
|
||||
<CursorPos X="66" Y="220"/>
|
||||
<UsageCount Value="67"/>
|
||||
<UsageCount Value="94"/>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
</Unit1>
|
||||
@ -32,25 +32,25 @@
|
||||
<WindowIndex Value="1"/>
|
||||
<TopLine Value="31"/>
|
||||
<CursorPos X="48" Y="14"/>
|
||||
<UsageCount Value="50"/>
|
||||
<UsageCount Value="77"/>
|
||||
</Unit2>
|
||||
<Unit3>
|
||||
<Filename Value="..\lazautoupdate_httpclient.pas"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<CursorPos X="97" Y="12"/>
|
||||
<UsageCount Value="22"/>
|
||||
<UsageCount Value="19"/>
|
||||
</Unit3>
|
||||
<Unit4>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<TopLine Value="44"/>
|
||||
<CursorPos X="63" Y="61"/>
|
||||
<ExtraEditorCount Value="2"/>
|
||||
<ExtraEditor1>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<WindowIndex Value="1"/>
|
||||
<TopLine Value="1707"/>
|
||||
<CursorPos X="44" Y="1747"/>
|
||||
<ExtraEditorCount Value="2"/>
|
||||
<ExtraEditor1>
|
||||
<EditorIndex Value="1"/>
|
||||
<TopLine Value="1058"/>
|
||||
<CursorPos X="68" Y="1025"/>
|
||||
</ExtraEditor1>
|
||||
<ExtraEditor2>
|
||||
<EditorIndex Value="-1"/>
|
||||
@ -58,7 +58,7 @@
|
||||
<TopLine Value="-1"/>
|
||||
<CursorPos X="-1" Y="-1"/>
|
||||
</ExtraEditor2>
|
||||
<UsageCount Value="32"/>
|
||||
<UsageCount Value="45"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit4>
|
||||
<Unit5>
|
||||
@ -67,20 +67,20 @@
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="101"/>
|
||||
<CursorPos Y="154"/>
|
||||
<UsageCount Value="9"/>
|
||||
<UsageCount Value="6"/>
|
||||
</Unit5>
|
||||
<Unit6>
|
||||
<Filename Value="..\..\..\..\applications\foobot\monitor\foobot_sensors.pas"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="76"/>
|
||||
<CursorPos X="75" Y="77"/>
|
||||
<UsageCount Value="9"/>
|
||||
<UsageCount Value="6"/>
|
||||
</Unit6>
|
||||
<Unit7>
|
||||
<Filename Value="..\..\..\..\applications\foobot\foobot.lpr"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<CursorPos Y="21"/>
|
||||
<UsageCount Value="9"/>
|
||||
<UsageCount Value="6"/>
|
||||
</Unit7>
|
||||
<Unit8>
|
||||
<Filename Value="C:\trunklatest\lazarus\lcl\asyncprocess.pp"/>
|
||||
@ -88,27 +88,27 @@
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="22"/>
|
||||
<CursorPos X="31" Y="31"/>
|
||||
<UsageCount Value="11"/>
|
||||
<UsageCount Value="8"/>
|
||||
</Unit8>
|
||||
<Unit9>
|
||||
<Filename Value="C:\trunklatest\lazarus\components\lazutils\utf8process.pp"/>
|
||||
<UnitName Value="UTF8Process"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<CursorPos X="3" Y="85"/>
|
||||
<UsageCount Value="11"/>
|
||||
<UsageCount Value="8"/>
|
||||
</Unit9>
|
||||
<Unit10>
|
||||
<Filename Value="..\..\..\..\applications\foobot\monitor\umainform.pas"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="25"/>
|
||||
<CursorPos X="22" Y="36"/>
|
||||
<UsageCount Value="20"/>
|
||||
<UsageCount Value="17"/>
|
||||
</Unit10>
|
||||
<Unit11>
|
||||
<Filename Value="C:\trunklatest\fpc\rtl\objpas\sysutils\osutilsh.inc"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<CursorPos X="10" Y="20"/>
|
||||
<UsageCount Value="10"/>
|
||||
<UsageCount Value="7"/>
|
||||
</Unit11>
|
||||
<Unit12>
|
||||
<Filename Value="..\versionsupport.pas"/>
|
||||
@ -116,28 +116,28 @@
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="4"/>
|
||||
<CursorPos X="8" Y="31"/>
|
||||
<UsageCount Value="17"/>
|
||||
<UsageCount Value="14"/>
|
||||
</Unit12>
|
||||
<Unit13>
|
||||
<Filename Value="C:\laztrunk\fpc\examples\httpd22\minimain.pas"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<WindowIndex Value="1"/>
|
||||
<TopLine Value="3"/>
|
||||
<UsageCount Value="9"/>
|
||||
<UsageCount Value="6"/>
|
||||
</Unit13>
|
||||
<Unit14>
|
||||
<Filename Value="..\uappisrunning.pas"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<WindowIndex Value="1"/>
|
||||
<TopLine Value="124"/>
|
||||
<UsageCount Value="9"/>
|
||||
<UsageCount Value="6"/>
|
||||
</Unit14>
|
||||
<Unit15>
|
||||
<Filename Value="..\..\..\cryptini\latest_stable\ucryptini.pas"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<WindowIndex Value="1"/>
|
||||
<TopLine Value="372"/>
|
||||
<UsageCount Value="9"/>
|
||||
<UsageCount Value="6"/>
|
||||
</Unit15>
|
||||
<Unit16>
|
||||
<Filename Value="..\updatehmsource\updatehm.lpr"/>
|
||||
@ -145,7 +145,7 @@
|
||||
<WindowIndex Value="1"/>
|
||||
<TopLine Value="132"/>
|
||||
<CursorPos X="6" Y="338"/>
|
||||
<UsageCount Value="22"/>
|
||||
<UsageCount Value="35"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit16>
|
||||
<Unit17>
|
||||
@ -154,13 +154,13 @@
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="24"/>
|
||||
<CursorPos Y="33"/>
|
||||
<UsageCount Value="11"/>
|
||||
<UsageCount Value="8"/>
|
||||
</Unit17>
|
||||
<Unit18>
|
||||
<Filename Value="..\trayicon\trayupdater.lpr"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<WindowIndex Value="1"/>
|
||||
<UsageCount Value="10"/>
|
||||
<UsageCount Value="7"/>
|
||||
</Unit18>
|
||||
<Unit19>
|
||||
<Filename Value="..\..\..\mbColorLib\mbutils.pas"/>
|
||||
@ -168,28 +168,28 @@
|
||||
<EditorIndex Value="-1"/>
|
||||
<WindowIndex Value="1"/>
|
||||
<TopLine Value="4"/>
|
||||
<UsageCount Value="10"/>
|
||||
<UsageCount Value="7"/>
|
||||
</Unit19>
|
||||
<Unit20>
|
||||
<Filename Value="..\..\..\mbColorLib\ScreenWin.pas"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<WindowIndex Value="1"/>
|
||||
<UsageCount Value="10"/>
|
||||
<UsageCount Value="7"/>
|
||||
</Unit20>
|
||||
<Unit21>
|
||||
<Filename Value="..\..\..\mbColorLib\LVColorPicker.pas"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<WindowIndex Value="1"/>
|
||||
<TopLine Value="290"/>
|
||||
<UsageCount Value="10"/>
|
||||
<UsageCount Value="7"/>
|
||||
</Unit21>
|
||||
<Unit22>
|
||||
<Filename Value="..\ushortcut.pas"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<EditorIndex Value="4"/>
|
||||
<TopLine Value="251"/>
|
||||
<CursorPos X="69" Y="278"/>
|
||||
<UsageCount Value="23"/>
|
||||
<TopLine Value="219"/>
|
||||
<CursorPos X="87" Y="240"/>
|
||||
<UsageCount Value="36"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit22>
|
||||
<Unit23>
|
||||
@ -197,14 +197,14 @@
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="116"/>
|
||||
<CursorPos X="24" Y="125"/>
|
||||
<UsageCount Value="11"/>
|
||||
<UsageCount Value="8"/>
|
||||
</Unit23>
|
||||
<Unit24>
|
||||
<Filename Value="C:\laztrunk\fpc\packages\winunits-base\src\shlobj.pp"/>
|
||||
<EditorIndex Value="7"/>
|
||||
<TopLine Value="2203"/>
|
||||
<CursorPos X="56" Y="2335"/>
|
||||
<UsageCount Value="12"/>
|
||||
<UsageCount Value="25"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit24>
|
||||
<Unit25>
|
||||
@ -212,7 +212,7 @@
|
||||
<EditorIndex Value="3"/>
|
||||
<TopLine Value="399"/>
|
||||
<CursorPos X="30" Y="426"/>
|
||||
<UsageCount Value="11"/>
|
||||
<UsageCount Value="24"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit25>
|
||||
<Unit26>
|
||||
@ -220,14 +220,14 @@
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="12"/>
|
||||
<CursorPos X="5" Y="39"/>
|
||||
<UsageCount Value="10"/>
|
||||
<UsageCount Value="7"/>
|
||||
</Unit26>
|
||||
<Unit27>
|
||||
<Filename Value="..\aboutlazautoupdateunit.pas"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<TopLine Value="65"/>
|
||||
<CursorPos X="41" Y="86"/>
|
||||
<UsageCount Value="11"/>
|
||||
<UsageCount Value="24"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit27>
|
||||
<Unit28>
|
||||
@ -235,13 +235,13 @@
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="10"/>
|
||||
<CursorPos X="25" Y="40"/>
|
||||
<UsageCount Value="10"/>
|
||||
<UsageCount Value="7"/>
|
||||
</Unit28>
|
||||
<Unit29>
|
||||
<Filename Value="C:\laztrunk\fpc\rtl\objpas\sysutils\finah.inc"/>
|
||||
<EditorIndex Value="6"/>
|
||||
<CursorPos X="10" Y="33"/>
|
||||
<UsageCount Value="10"/>
|
||||
<UsageCount Value="23"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit29>
|
||||
<Unit30>
|
||||
@ -250,7 +250,7 @@
|
||||
<EditorIndex Value="5"/>
|
||||
<TopLine Value="273"/>
|
||||
<CursorPos X="3" Y="278"/>
|
||||
<UsageCount Value="10"/>
|
||||
<UsageCount Value="23"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit30>
|
||||
</Units>
|
||||
@ -259,124 +259,124 @@
|
||||
</OtherDefines>
|
||||
<JumpHistory Count="30" HistoryIndex="29">
|
||||
<Position1>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="785" TopLine="758"/>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="176" Column="4" TopLine="157"/>
|
||||
</Position1>
|
||||
<Position2>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="784" Column="41" TopLine="757"/>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="170" Column="45" TopLine="159"/>
|
||||
</Position2>
|
||||
<Position3>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="474" TopLine="456"/>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="194" TopLine="170"/>
|
||||
</Position3>
|
||||
<Position4>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="966" Column="70" TopLine="931"/>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="147" TopLine="145"/>
|
||||
</Position4>
|
||||
<Position5>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="15" Column="16" TopLine="8"/>
|
||||
<Caret Line="146" TopLine="144"/>
|
||||
</Position5>
|
||||
<Position6>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="152" Column="37" TopLine="146"/>
|
||||
<Caret Line="148" TopLine="146"/>
|
||||
</Position6>
|
||||
<Position7>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="154" Column="37" TopLine="148"/>
|
||||
<Caret Line="125" TopLine="108"/>
|
||||
</Position7>
|
||||
<Position8>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="1014" Column="57" TopLine="977"/>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="118" Column="30" TopLine="93"/>
|
||||
</Position8>
|
||||
<Position9>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="176" Column="4" TopLine="157"/>
|
||||
<Caret Line="124" Column="45" TopLine="103"/>
|
||||
</Position9>
|
||||
<Position10>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="170" Column="45" TopLine="159"/>
|
||||
<Caret Line="125" Column="45" TopLine="104"/>
|
||||
</Position10>
|
||||
<Position11>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="194" TopLine="170"/>
|
||||
<Caret Line="198" Column="3" TopLine="196"/>
|
||||
</Position11>
|
||||
<Position12>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="147" TopLine="145"/>
|
||||
<Caret Line="214" Column="56" TopLine="201"/>
|
||||
</Position12>
|
||||
<Position13>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="146" TopLine="144"/>
|
||||
<Caret Line="216" Column="56" TopLine="203"/>
|
||||
</Position13>
|
||||
<Position14>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="148" TopLine="146"/>
|
||||
</Position14>
|
||||
<Position15>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="125" TopLine="108"/>
|
||||
</Position15>
|
||||
<Position16>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="118" Column="30" TopLine="93"/>
|
||||
</Position16>
|
||||
<Position17>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="124" Column="45" TopLine="103"/>
|
||||
</Position17>
|
||||
<Position18>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="125" Column="45" TopLine="104"/>
|
||||
</Position18>
|
||||
<Position19>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="198" Column="3" TopLine="196"/>
|
||||
</Position19>
|
||||
<Position20>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="214" Column="56" TopLine="201"/>
|
||||
</Position20>
|
||||
<Position21>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="216" Column="56" TopLine="203"/>
|
||||
</Position21>
|
||||
<Position22>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="1004" Column="101" TopLine="970"/>
|
||||
</Position14>
|
||||
<Position15>
|
||||
<Filename Value="..\ushortcut.pas"/>
|
||||
<Caret Line="268" Column="79" TopLine="239"/>
|
||||
</Position15>
|
||||
<Position16>
|
||||
<Filename Value="..\ushortcut.pas"/>
|
||||
<Caret Line="235" Column="60" TopLine="216"/>
|
||||
</Position16>
|
||||
<Position17>
|
||||
<Filename Value="..\ushortcut.pas"/>
|
||||
<Caret Line="272" Column="25" TopLine="245"/>
|
||||
</Position17>
|
||||
<Position18>
|
||||
<Filename Value="..\ushortcut.pas"/>
|
||||
<Caret Line="233" Column="47" TopLine="214"/>
|
||||
</Position18>
|
||||
<Position19>
|
||||
<Filename Value="..\ushortcut.pas"/>
|
||||
<Caret Line="239" Column="20" TopLine="229"/>
|
||||
</Position19>
|
||||
<Position20>
|
||||
<Filename Value="..\ushortcut.pas"/>
|
||||
<Caret Line="295" Column="31" TopLine="259"/>
|
||||
</Position20>
|
||||
<Position21>
|
||||
<Filename Value="..\ushortcut.pas"/>
|
||||
<Caret Line="289" Column="22" TopLine="268"/>
|
||||
</Position21>
|
||||
<Position22>
|
||||
<Filename Value="..\ushortcut.pas"/>
|
||||
<Caret Line="278" Column="71" TopLine="268"/>
|
||||
</Position22>
|
||||
<Position23>
|
||||
<Filename Value="..\ushortcut.pas"/>
|
||||
<Caret Line="268" Column="79" TopLine="239"/>
|
||||
<Caret Line="306" Column="78" TopLine="269"/>
|
||||
</Position23>
|
||||
<Position24>
|
||||
<Filename Value="..\ushortcut.pas"/>
|
||||
<Caret Line="235" Column="60" TopLine="216"/>
|
||||
<Caret Line="289" Column="57" TopLine="261"/>
|
||||
</Position24>
|
||||
<Position25>
|
||||
<Filename Value="..\ushortcut.pas"/>
|
||||
<Caret Line="272" Column="25" TopLine="245"/>
|
||||
<Caret Line="255" Column="57" TopLine="229"/>
|
||||
</Position25>
|
||||
<Position26>
|
||||
<Filename Value="..\ushortcut.pas"/>
|
||||
<Caret Line="233" Column="47" TopLine="214"/>
|
||||
<Caret Line="308" Column="21" TopLine="277"/>
|
||||
</Position26>
|
||||
<Position27>
|
||||
<Filename Value="..\ushortcut.pas"/>
|
||||
<Caret Line="239" Column="20" TopLine="229"/>
|
||||
<Caret Line="149" Column="39" TopLine="121"/>
|
||||
</Position27>
|
||||
<Position28>
|
||||
<Filename Value="..\ushortcut.pas"/>
|
||||
<Caret Line="295" Column="31" TopLine="259"/>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="999" Column="4" TopLine="970"/>
|
||||
</Position28>
|
||||
<Position29>
|
||||
<Filename Value="..\ushortcut.pas"/>
|
||||
<Caret Line="289" Column="22" TopLine="268"/>
|
||||
<Caret Line="186" Column="24" TopLine="160"/>
|
||||
</Position29>
|
||||
<Position30>
|
||||
<Filename Value="..\ushortcut.pas"/>
|
||||
<Caret Line="278" Column="71" TopLine="268"/>
|
||||
<Caret Line="245" Column="26" TopLine="218"/>
|
||||
</Position30>
|
||||
</JumpHistory>
|
||||
</ProjectSession>
|
||||
|
@ -996,12 +996,12 @@ begin
|
||||
Result := CreateDesktopShortCut(fShortCutClass.Target,
|
||||
fShortCutClass.TargetArguments, fShortCutClass.ShortcutName,
|
||||
fShortCutClass.IconFileName, fShortCutClass.CategoryString);
|
||||
|
||||
fLastError:=GetShortCutDebugString;
|
||||
if fFireDebugEvent then
|
||||
if Result = True then
|
||||
fOndebugEvent(Self, 'MakeShortCut', 'MakeShortCut succeded.')
|
||||
else
|
||||
fOndebugEvent(Self, 'MakeShortCut', 'MakeShortCut failed. Error: ' + GetShortCutErrorString);
|
||||
fOndebugEvent(Self, 'MakeShortCut', 'MakeShortCut failed. Error(s): ' + GetShortCutDebugString);
|
||||
end;
|
||||
|
||||
function TLazAutoUpdate.DeleteShortCut: boolean;
|
||||
@ -1025,7 +1025,7 @@ begin
|
||||
if Result = True then
|
||||
fOndebugEvent(Self, 'MakeShortCut', 'DeleteShortCut succeded.')
|
||||
else
|
||||
fOndebugEvent(Self, 'MakeShortCut', 'DeleteShortCut failed. Error: ' + GetShortCutErrorString);
|
||||
fOndebugEvent(Self, 'MakeShortCut', 'DeleteShortCut failed. Error: ' + GetShortCutDebugString);
|
||||
|
||||
end;
|
||||
|
||||
|
@ -36,7 +36,7 @@ Code adapted from fpcup (@BigChimp and @DonAlfredo at freepascal forum)
|
||||
|
||||
Use
|
||||
===
|
||||
Use public function 'GetShortCutErrorString' to show an error when debugging
|
||||
Use public function 'GetShortCutErrorString' to show errors/info when debugging
|
||||
|
||||
Linux Shortcut Info
|
||||
===================
|
||||
@ -85,28 +85,34 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, LazUTF8, FileUtil, LazFileUtils
|
||||
{$IFDEF LINUX}, process{$ENDIF}
|
||||
{$IFDEF LINUX},process,strutils{$ENDIF}
|
||||
{$IFDEF WINDOWS}, Windows, shlobj {for special folders}, ActiveX,
|
||||
ComObj, ShellAPI{$ENDIF} ;
|
||||
|
||||
function CreateDesktopShortCut(Target, TargetArguments, ShortcutName,
|
||||
IconFileName, Category: string): boolean;
|
||||
|
||||
function DeleteDesktopShortcut(ShortcutName: string): boolean;
|
||||
|
||||
function GetShortCutErrorString: string;
|
||||
function GetShortCutDebugString: string;
|
||||
|
||||
implementation
|
||||
|
||||
var
|
||||
sErrorString: string;
|
||||
|
||||
function GetShortCutErrorString: string;
|
||||
sDebugString: string;
|
||||
// Functions and procs to aid Debugging
|
||||
function GetShortCutDebugString: string;
|
||||
begin
|
||||
if (sErrorString = '') then
|
||||
if (sDebugString = '') then
|
||||
Result := 'OK'
|
||||
else
|
||||
Result := sErrorString;
|
||||
Result := sDebugString;
|
||||
end;
|
||||
// Builds up a string with linebreaks
|
||||
procedure AddToDebugString(Astring:String);
|
||||
begin
|
||||
if (sDebugString = '') then
|
||||
sDebugString:=LineEnding + '* ' + Astring
|
||||
else
|
||||
sDebugString:=sDebugString + LineEnding + '* ' + Astring;
|
||||
end;
|
||||
|
||||
{$IFDEF UNIX}
|
||||
@ -138,7 +144,7 @@ IN:
|
||||
OUT:
|
||||
True = Success
|
||||
False = Fail
|
||||
Use function GetShortCutErrorString to get most recent error as a string
|
||||
Use function GetShortCutDebugString to get most recent error as a string
|
||||
}
|
||||
var
|
||||
IObject: IUnknown;
|
||||
@ -149,19 +155,21 @@ var
|
||||
LinkName: WideString;
|
||||
begin
|
||||
Result := True;
|
||||
sErrorString := 'OK';
|
||||
sDebugString := '';
|
||||
// Simple failure check
|
||||
if not FileExistsUTF8(Target) then
|
||||
begin
|
||||
AddToDebugString('Filename ' + Target + ' does not exist');
|
||||
Result := False;
|
||||
if Result = False then
|
||||
Exit;
|
||||
end;
|
||||
|
||||
try
|
||||
{ Creates an instance of IShellLink }
|
||||
IObject := CreateComObject(CLSID_ShellLink);
|
||||
ISLink := IObject as IShellLink;
|
||||
IPFile := IObject as IPersistFile;
|
||||
|
||||
TRY
|
||||
ISLink.SetPath(PChar(Target));
|
||||
ISLink.SetArguments(PChar(TargetArguments));
|
||||
ISLink.SetWorkingDirectory(PChar(ExtractFilePath(Target)));
|
||||
@ -172,10 +180,13 @@ begin
|
||||
LinkName := IncludeTrailingPathDelimiter(InFolder) + ShortcutName + '.lnk';
|
||||
|
||||
{ Get rid of any existing shortcut first }
|
||||
SysUtils.DeleteFile(LinkName);
|
||||
|
||||
If Not SysUtils.DeleteFile(LinkName) then
|
||||
AddToDebugString('Could not delete existing link ' + LinkName);
|
||||
{ Create the link }
|
||||
IPFile.Save(PWChar(LinkName), False);
|
||||
finally
|
||||
FreeAndNil(IPFile);
|
||||
end;
|
||||
except
|
||||
Result := False;
|
||||
end;
|
||||
@ -195,113 +206,133 @@ IN:
|
||||
OUT:
|
||||
True = Success
|
||||
False = Fail
|
||||
Use function GetShortCutErrorString to get most recent error as a string
|
||||
Use function GetShortCutDebugString to get errors as a string
|
||||
}
|
||||
var
|
||||
XdgDesktopContent: TStringList;
|
||||
XdgDesktopStringList: TStrings;
|
||||
XdgDesktopFile: string;
|
||||
Aprocess: TProcess;
|
||||
sPathToShare: string;
|
||||
sDesktopFilename:String;
|
||||
begin
|
||||
// Suceed by default:
|
||||
Result := True;
|
||||
sErrorString := 'OK';
|
||||
sDebugString := '';
|
||||
// Simple failure checks
|
||||
if not FileExistsUTF8(Target) then
|
||||
begin
|
||||
sErrorString := 'File "' + Target + '" cannot be located.';
|
||||
AddToDebugString('File "' + Target + '" cannot be located. Quitting.');
|
||||
Result := False;
|
||||
Exit;
|
||||
end;
|
||||
if not FileExistsUTF8(IconFileName) then
|
||||
begin
|
||||
sErrorString := 'File "' + IconFileName + '" cannot be located.';
|
||||
AddToDebugString('File "' + IconFileName + '" cannot be located. Using Target.');
|
||||
IconFileName := Target;
|
||||
end;
|
||||
if ShortCutName = '' then
|
||||
begin
|
||||
sErrorString := 'ShortcutName is blank.';
|
||||
AddToDebugString('ShortcutName is blank. Quitting.');
|
||||
Result := False;
|
||||
Exit;
|
||||
end;
|
||||
|
||||
if Category = '' then
|
||||
begin
|
||||
sErrorString := 'Category is blank. Using "Utility"';
|
||||
AddToDebugString('Category is blank. Using "Utility"');
|
||||
Category := 'Utility';
|
||||
end;
|
||||
// Make up a compliant filename
|
||||
sDesktopFilename:=Copy2Space(shortcutname);
|
||||
sDesktopFilename:=LeftStr(sDesktopFilename,8);
|
||||
AddToDebugString('Desktop filename = ' + sDesktopFilename);
|
||||
// Standard path to DeskTop files
|
||||
sPathToShare := IncludeTrailingPathDelimiter(ExpandFileNameUTF8('~')) +
|
||||
'usr/share/applications' + DirectorySeparator + 'test.desktop';
|
||||
{
|
||||
'usr/share/applications' + DirectorySeparator +
|
||||
sDesktopFilename + '.desktop';
|
||||
// Temp directory path
|
||||
XdgDesktopFile := IncludeTrailingPathDelimiter(GetTempDir(False)) +
|
||||
shortcutname + '.desktop';
|
||||
}
|
||||
// ExtractFileNameOnly(GetTempDir(False));
|
||||
XdgDesktopFile := IncludeTrailingPathDelimiter(GetTempDir(False)) +
|
||||
'test.desktop';
|
||||
XdgDesktopContent := TStringList.Create;
|
||||
sDesktopFilename + '.desktop';
|
||||
|
||||
AddToDebugString('XdgDesktopFile = ' + XdgDesktopFile);
|
||||
AddToDebugString('sPathToShare = ' + sPathToShare);
|
||||
|
||||
// Make up the desktop file
|
||||
XdgDesktopStringList := TStringList.Create;
|
||||
try
|
||||
XdgDesktopContent.Add('[Desktop Entry]');
|
||||
XdgDesktopContent.Add('Encoding=UTF-8');
|
||||
XdgDesktopContent.Add('Type=Application');
|
||||
//XdgDesktopContent.Add('Nodisplay=True');
|
||||
XdgDesktopContent.Add('Icon=' + IconFileName);
|
||||
XdgDesktopStringList.Add('[Desktop Entry]');
|
||||
XdgDesktopStringList.Add('Encoding=UTF-8');
|
||||
XdgDesktopStringList.Add('Type=Application');
|
||||
//XdgDesktopStringList.Add('NoDisplay=True');
|
||||
XdgDesktopStringList.Add('Icon=' + IconFileName);
|
||||
if TargetArguments <> '' then
|
||||
XdgDesktopContent.Add('Exec=' + Target + ' ' + TargetArguments)
|
||||
XdgDesktopStringList.Add('Exec=' + Target + ' ' + TargetArguments)
|
||||
else
|
||||
XdgDesktopContent.Add('Exec=' + Target);
|
||||
XdgDesktopContent.Add('Name=' + ShortcutName);
|
||||
XdgDesktopContent.Add('Category=' + Category);
|
||||
XdgDesktopStringList.Add('Exec=' + Target);
|
||||
XdgDesktopStringList.Add('Name=' + ShortcutName);
|
||||
XdgDesktopStringList.Add('Category=' + Category);
|
||||
// We're going to try and call xdg-desktop-icon
|
||||
// this may fail if shortcut exists already
|
||||
AProcess := TProcess.Create(nil);
|
||||
try
|
||||
try
|
||||
if FileExistsUTF8(XdgDesktopFile) then DeleteFile(XdgDesktopFile);
|
||||
XdgDesktopContent.SaveToFile(XdgDesktopFile);
|
||||
Sleep(100);
|
||||
XdgDesktopStringList.SaveToFile(XdgDesktopFile);
|
||||
if Not FileExistsUTF8(XdgDesktopFile) then
|
||||
AddToDebugString('XdgDesktopFile wasn''t saved');
|
||||
if FileExistsUTF8(XdgDesktopFile) then
|
||||
begin
|
||||
Sleep(100);
|
||||
Aprocess.Executable := 'xdg-desktop-icon install';
|
||||
AProcess.CurrentDirectory := ProgramDirectory;
|
||||
AProcess.Parameters.Clear;
|
||||
AProcess.Parameters.Add(XdgDesktopFile);
|
||||
Aprocess.Execute;
|
||||
Sleep(100);
|
||||
end
|
||||
end;
|
||||
except
|
||||
// xdg-desktop-icon install failed.
|
||||
Result := False;
|
||||
AddToDebugString('Exception running "xdg-desktop-icon install"');
|
||||
|
||||
// OK. Try usr/share/applications
|
||||
if FileExistsUTF8(sPathToShare) then
|
||||
begin
|
||||
If SysUtils.DeleteFile(sPathToShare) then
|
||||
AddToDebugString('Successfully deleted existing ' + sPathToShare)
|
||||
else
|
||||
if FileExistsUTF8(sPathToShare) then DeleteFile(sPathToShare);
|
||||
XdgDesktopContent.SaveToFile(sPathToShare);
|
||||
AddToDebugString('Unable to delete existing ' + sPathToShare);
|
||||
end;
|
||||
// Save the stringlist directly to usr/share/applications
|
||||
XdgDesktopStringList.SaveToFile(sPathToShare);
|
||||
If Not FileExistsUTF8(sPathToShare) then
|
||||
begin
|
||||
Result:=FALSE;
|
||||
sErrorString := 'SaveToFile(' + sPathToShare + ') failed';
|
||||
AddToDebugString('SaveToFile(' + sPathToShare + ') failed');
|
||||
end;
|
||||
except
|
||||
Result := False;
|
||||
sErrorString := 'Exception running "xdg-desktop-icon install"';
|
||||
end;
|
||||
finally
|
||||
AProcess.Free;
|
||||
end;
|
||||
if Result = False then
|
||||
// Temp file is no longer needed....
|
||||
try
|
||||
If FileExistsUTF8(XdgDesktopFile) then
|
||||
If (FileExistsUTF8(XdgDesktopFile)) AND (NOT FileExistsUTF8(sPathToShare)) then
|
||||
BEGIN
|
||||
// Last try to copy file to usr/share/applications
|
||||
if CopyFile(XdgDesktopFile, sPathToShare) then
|
||||
Result := True
|
||||
else
|
||||
sErrorString := Format('Unable to copy %s file to %s', [XdgDesktopFile, sPathToShare]);
|
||||
if not DeleteFile(XdgDesktopFile) then
|
||||
sErrorString := 'Unable to delete temporary ' + XdgDesktopFile;
|
||||
AddToDebugString(Format('Unable to copy %s file to %s', [XdgDesktopFile, sPathToShare]));
|
||||
// Temp file is no longer needed....
|
||||
if not SysUtils.DeleteFile(XdgDesktopFile) then
|
||||
AddToDebugString('Unable to delete temporary ' + XdgDesktopFile);
|
||||
end
|
||||
else sErrorString := 'Unable to locate temporary ' + XdgDesktopFile;
|
||||
else AddToDebugString('Unable to locate temporary ' + XdgDesktopFile);
|
||||
finally
|
||||
// Swallow, let filesystem maintenance clear it up
|
||||
end;
|
||||
finally
|
||||
XdgDesktopContent.Free;
|
||||
XdgDesktopStringList.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -314,7 +345,7 @@ var
|
||||
LinkName: WideString;
|
||||
begin
|
||||
Result := False;
|
||||
sErrorString := 'OK';
|
||||
sDebugString := '';
|
||||
try
|
||||
{ Get the desktop location }
|
||||
SHGetSpecialFolderLocation(0, CSIDL_DESKTOPDIRECTORY, PIDL);
|
||||
@ -323,7 +354,7 @@ begin
|
||||
if SysUtils.DeleteFile(LinkName) then
|
||||
Result := True;
|
||||
except
|
||||
sErrorString := 'Exception deleting ' + LinkName;
|
||||
AddToDebugString('Exception deleting ' + LinkName);
|
||||
// Eat the exception
|
||||
end;
|
||||
end;
|
||||
@ -331,7 +362,7 @@ end;
|
||||
{$ELSE}
|
||||
function DeleteDesktopShortcut(ShortcutName: string): boolean;
|
||||
begin
|
||||
sErrorString := 'OK';
|
||||
sDebugString := 'DeleteDesktopShortcut not implemented in Linux';
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
|
Reference in New Issue
Block a user