You've already forked lazarus-ccr
To V0.3.6.0
Bugfix in MakeShortCut (Windows) and other fixes git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5723 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -66,7 +66,7 @@ More information in the Wiki Home Page http://wiki.freepascal.org/LazAutoUpdater
|
||||
along with this library; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
"/>
|
||||
<Version Minor="3" Release="5"/>
|
||||
<Version Minor="3" Release="6"/>
|
||||
<Files Count="7">
|
||||
<Item1>
|
||||
<Filename Value="ulazautoupdate.pas"/>
|
||||
|
@ -19,13 +19,14 @@
|
||||
</General>
|
||||
<VersionInfo>
|
||||
<UseVersionInfo Value="True"/>
|
||||
<MajorVersionNr Value="1"/>
|
||||
<MinorVersionNr Value="1"/>
|
||||
<RevisionNr Value="3"/>
|
||||
<RevisionNr Value="5"/>
|
||||
<BuildNr Value="1"/>
|
||||
<StringTable ProductVersion="0.0.0.0"/>
|
||||
</VersionInfo>
|
||||
<BuildModes Count="5">
|
||||
<Item1 Name="Win32Debug" Default="True"/>
|
||||
<Item1 Name="Debug" Default="True"/>
|
||||
<Item2 Name="Win32">
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
@ -127,6 +128,11 @@
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
<Other>
|
||||
<OtherDefines Count="1">
|
||||
<Define0 Value="DEBUGMODE"/>
|
||||
</OtherDefines>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
</Item4>
|
||||
<Item5 Name="Linux64">
|
||||
|
@ -4,13 +4,13 @@
|
||||
<PathDelim Value="\"/>
|
||||
<Version Value="10"/>
|
||||
<BuildModes Active="Linux64"/>
|
||||
<Units Count="34">
|
||||
<Units Count="35">
|
||||
<Unit0>
|
||||
<Filename Value="testapp.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<EditorIndex Value="11"/>
|
||||
<CursorPos X="25" Y="28"/>
|
||||
<UsageCount Value="94"/>
|
||||
<UsageCount Value="96"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
@ -19,9 +19,9 @@
|
||||
<ComponentName Value="mainform"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<TopLine Value="177"/>
|
||||
<CursorPos X="36" Y="181"/>
|
||||
<UsageCount Value="94"/>
|
||||
<TopLine Value="176"/>
|
||||
<CursorPos X="3" Y="178"/>
|
||||
<UsageCount Value="96"/>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
</Unit1>
|
||||
@ -32,7 +32,7 @@
|
||||
<WindowIndex Value="1"/>
|
||||
<TopLine Value="31"/>
|
||||
<CursorPos X="48" Y="14"/>
|
||||
<UsageCount Value="77"/>
|
||||
<UsageCount Value="79"/>
|
||||
</Unit2>
|
||||
<Unit3>
|
||||
<Filename Value="..\lazautoupdate_httpclient.pas"/>
|
||||
@ -42,15 +42,14 @@
|
||||
</Unit3>
|
||||
<Unit4>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<WindowIndex Value="1"/>
|
||||
<TopLine Value="1707"/>
|
||||
<CursorPos X="44" Y="1747"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<TopLine Value="987"/>
|
||||
<CursorPos X="70" Y="1026"/>
|
||||
<ExtraEditorCount Value="2"/>
|
||||
<ExtraEditor1>
|
||||
<EditorIndex Value="1"/>
|
||||
<TopLine Value="44"/>
|
||||
<CursorPos X="63" Y="61"/>
|
||||
<WindowIndex Value="1"/>
|
||||
<TopLine Value="948"/>
|
||||
<CursorPos Y="971"/>
|
||||
</ExtraEditor1>
|
||||
<ExtraEditor2>
|
||||
<EditorIndex Value="-1"/>
|
||||
@ -58,7 +57,7 @@
|
||||
<TopLine Value="-1"/>
|
||||
<CursorPos X="-1" Y="-1"/>
|
||||
</ExtraEditor2>
|
||||
<UsageCount Value="45"/>
|
||||
<UsageCount Value="46"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit4>
|
||||
<Unit5>
|
||||
@ -141,11 +140,11 @@
|
||||
</Unit15>
|
||||
<Unit16>
|
||||
<Filename Value="..\updatehmsource\updatehm.lpr"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<WindowIndex Value="1"/>
|
||||
<TopLine Value="132"/>
|
||||
<CursorPos X="6" Y="338"/>
|
||||
<UsageCount Value="35"/>
|
||||
<UsageCount Value="36"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit16>
|
||||
<Unit17>
|
||||
@ -187,9 +186,9 @@
|
||||
<Filename Value="..\ushortcut.pas"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<EditorIndex Value="6"/>
|
||||
<TopLine Value="179"/>
|
||||
<CursorPos X="9" Y="221"/>
|
||||
<UsageCount Value="36"/>
|
||||
<TopLine Value="351"/>
|
||||
<CursorPos X="16" Y="338"/>
|
||||
<UsageCount Value="37"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit22>
|
||||
<Unit23>
|
||||
@ -202,9 +201,9 @@
|
||||
<Unit24>
|
||||
<Filename Value="C:\laztrunk\fpc\packages\winunits-base\src\shlobj.pp"/>
|
||||
<EditorIndex Value="10"/>
|
||||
<TopLine Value="2203"/>
|
||||
<CursorPos X="56" Y="2335"/>
|
||||
<UsageCount Value="25"/>
|
||||
<TopLine Value="2308"/>
|
||||
<CursorPos X="18" Y="2335"/>
|
||||
<UsageCount Value="26"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit24>
|
||||
<Unit25>
|
||||
@ -212,7 +211,7 @@
|
||||
<EditorIndex Value="3"/>
|
||||
<TopLine Value="662"/>
|
||||
<CursorPos X="25" Y="697"/>
|
||||
<UsageCount Value="24"/>
|
||||
<UsageCount Value="25"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit25>
|
||||
<Unit26>
|
||||
@ -227,7 +226,7 @@
|
||||
<EditorIndex Value="2"/>
|
||||
<TopLine Value="65"/>
|
||||
<CursorPos X="41" Y="86"/>
|
||||
<UsageCount Value="24"/>
|
||||
<UsageCount Value="25"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit27>
|
||||
<Unit28>
|
||||
@ -241,7 +240,7 @@
|
||||
<Filename Value="C:\laztrunk\fpc\rtl\objpas\sysutils\finah.inc"/>
|
||||
<EditorIndex Value="9"/>
|
||||
<CursorPos X="38" Y="36"/>
|
||||
<UsageCount Value="23"/>
|
||||
<UsageCount Value="24"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit29>
|
||||
<Unit30>
|
||||
@ -250,7 +249,7 @@
|
||||
<EditorIndex Value="8"/>
|
||||
<TopLine Value="58"/>
|
||||
<CursorPos X="29" Y="87"/>
|
||||
<UsageCount Value="23"/>
|
||||
<UsageCount Value="24"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit30>
|
||||
<Unit31>
|
||||
@ -258,7 +257,7 @@
|
||||
<EditorIndex Value="7"/>
|
||||
<TopLine Value="1809"/>
|
||||
<CursorPos X="3" Y="1812"/>
|
||||
<UsageCount Value="10"/>
|
||||
<UsageCount Value="11"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit31>
|
||||
<Unit32>
|
||||
@ -266,7 +265,7 @@
|
||||
<EditorIndex Value="4"/>
|
||||
<TopLine Value="1110"/>
|
||||
<CursorPos X="10" Y="1116"/>
|
||||
<UsageCount Value="10"/>
|
||||
<UsageCount Value="11"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit32>
|
||||
<Unit33>
|
||||
@ -274,9 +273,19 @@
|
||||
<EditorIndex Value="5"/>
|
||||
<TopLine Value="10"/>
|
||||
<CursorPos X="24" Y="104"/>
|
||||
<UsageCount Value="10"/>
|
||||
<UsageCount Value="11"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit33>
|
||||
<Unit34>
|
||||
<Filename Value="C:\laztrunk\fpc\rtl\inc\objpas.inc"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<WindowIndex Value="1"/>
|
||||
<TopLine Value="308"/>
|
||||
<CursorPos Y="331"/>
|
||||
<UsageCount Value="11"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit34>
|
||||
</Units>
|
||||
<OtherDefines Count="1">
|
||||
<Define0 Value="DEBUGMODE"/>
|
||||
@ -284,123 +293,123 @@
|
||||
<JumpHistory Count="30" HistoryIndex="29">
|
||||
<Position1>
|
||||
<Filename Value="..\ushortcut.pas"/>
|
||||
<Caret Line="268" Column="79" TopLine="239"/>
|
||||
<Caret Line="186" Column="24" TopLine="160"/>
|
||||
</Position1>
|
||||
<Position2>
|
||||
<Filename Value="..\ushortcut.pas"/>
|
||||
<Caret Line="235" Column="60" TopLine="216"/>
|
||||
<Caret Line="245" Column="26" TopLine="218"/>
|
||||
</Position2>
|
||||
<Position3>
|
||||
<Filename Value="..\ushortcut.pas"/>
|
||||
<Caret Line="272" Column="25" TopLine="245"/>
|
||||
<Caret Line="246" Column="31" TopLine="222"/>
|
||||
</Position3>
|
||||
<Position4>
|
||||
<Filename Value="..\ushortcut.pas"/>
|
||||
<Caret Line="233" Column="47" TopLine="214"/>
|
||||
<Caret Line="248" Column="53" TopLine="222"/>
|
||||
</Position4>
|
||||
<Position5>
|
||||
<Filename Value="..\ushortcut.pas"/>
|
||||
<Caret Line="239" Column="20" TopLine="229"/>
|
||||
<Caret Line="212" Column="33" TopLine="184"/>
|
||||
</Position5>
|
||||
<Position6>
|
||||
<Filename Value="..\ushortcut.pas"/>
|
||||
<Caret Line="295" Column="31" TopLine="259"/>
|
||||
<Filename Value="C:\laztrunk\fpc\rtl\objpas\classes\stringl.inc"/>
|
||||
<Caret Line="1116" Column="75" TopLine="1116"/>
|
||||
</Position6>
|
||||
<Position7>
|
||||
<Filename Value="..\ushortcut.pas"/>
|
||||
<Caret Line="289" Column="22" TopLine="268"/>
|
||||
<Caret Line="287" TopLine="269"/>
|
||||
</Position7>
|
||||
<Position8>
|
||||
<Filename Value="..\ushortcut.pas"/>
|
||||
<Caret Line="278" Column="71" TopLine="268"/>
|
||||
<Filename Value="C:\laztrunk\fpc\rtl\objpas\sysutils\sysencodingh.inc"/>
|
||||
<Caret Line="104" Column="24" TopLine="66"/>
|
||||
</Position8>
|
||||
<Position9>
|
||||
<Filename Value="..\ushortcut.pas"/>
|
||||
<Caret Line="306" Column="78" TopLine="269"/>
|
||||
<Caret Line="283" Column="56" TopLine="256"/>
|
||||
</Position9>
|
||||
<Position10>
|
||||
<Filename Value="..\ushortcut.pas"/>
|
||||
<Caret Line="289" Column="57" TopLine="261"/>
|
||||
<Caret Line="312" Column="56" TopLine="285"/>
|
||||
</Position10>
|
||||
<Position11>
|
||||
<Filename Value="..\ushortcut.pas"/>
|
||||
<Caret Line="255" Column="57" TopLine="229"/>
|
||||
<Filename Value="C:\laztrunk\fpc\rtl\objpas\classes\stringl.inc"/>
|
||||
<Caret Line="1116" Column="10" TopLine="1110"/>
|
||||
</Position11>
|
||||
<Position12>
|
||||
<Filename Value="..\ushortcut.pas"/>
|
||||
<Caret Line="308" Column="21" TopLine="277"/>
|
||||
<Caret Line="283" Column="55" TopLine="256"/>
|
||||
</Position12>
|
||||
<Position13>
|
||||
<Filename Value="..\ushortcut.pas"/>
|
||||
<Caret Line="149" Column="39" TopLine="121"/>
|
||||
<Caret Line="212" Column="40" TopLine="185"/>
|
||||
</Position13>
|
||||
<Position14>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="999" Column="4" TopLine="970"/>
|
||||
<Filename Value="..\ushortcut.pas"/>
|
||||
<Caret Line="255" Column="75" TopLine="235"/>
|
||||
</Position14>
|
||||
<Position15>
|
||||
<Filename Value="..\ushortcut.pas"/>
|
||||
<Caret Line="186" Column="24" TopLine="160"/>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="218" Column="29" TopLine="208"/>
|
||||
</Position15>
|
||||
<Position16>
|
||||
<Filename Value="..\ushortcut.pas"/>
|
||||
<Caret Line="245" Column="26" TopLine="218"/>
|
||||
<Caret Line="264" Column="13" TopLine="238"/>
|
||||
</Position16>
|
||||
<Position17>
|
||||
<Filename Value="..\ushortcut.pas"/>
|
||||
<Caret Line="246" Column="31" TopLine="222"/>
|
||||
<Caret Line="183" Column="7" TopLine="165"/>
|
||||
</Position17>
|
||||
<Position18>
|
||||
<Filename Value="..\ushortcut.pas"/>
|
||||
<Caret Line="248" Column="53" TopLine="222"/>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="971" TopLine="948"/>
|
||||
</Position18>
|
||||
<Position19>
|
||||
<Filename Value="..\ushortcut.pas"/>
|
||||
<Caret Line="212" Column="33" TopLine="184"/>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="973" TopLine="970"/>
|
||||
</Position19>
|
||||
<Position20>
|
||||
<Filename Value="C:\laztrunk\fpc\rtl\objpas\classes\stringl.inc"/>
|
||||
<Caret Line="1116" Column="75" TopLine="1116"/>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="183" TopLine="175"/>
|
||||
</Position20>
|
||||
<Position21>
|
||||
<Filename Value="..\ushortcut.pas"/>
|
||||
<Caret Line="287" TopLine="269"/>
|
||||
<Caret Line="394" Column="68" TopLine="357"/>
|
||||
</Position21>
|
||||
<Position22>
|
||||
<Filename Value="C:\laztrunk\fpc\rtl\objpas\sysutils\sysencodingh.inc"/>
|
||||
<Caret Line="104" Column="24" TopLine="66"/>
|
||||
<Filename Value="..\ushortcut.pas"/>
|
||||
<Caret Line="176" Column="32" TopLine="158"/>
|
||||
</Position22>
|
||||
<Position23>
|
||||
<Filename Value="..\ushortcut.pas"/>
|
||||
<Caret Line="283" Column="56" TopLine="256"/>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="183" TopLine="175"/>
|
||||
</Position23>
|
||||
<Position24>
|
||||
<Filename Value="..\ushortcut.pas"/>
|
||||
<Caret Line="312" Column="56" TopLine="285"/>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="227" Column="3" TopLine="209"/>
|
||||
</Position24>
|
||||
<Position25>
|
||||
<Filename Value="C:\laztrunk\fpc\rtl\objpas\classes\stringl.inc"/>
|
||||
<Caret Line="1116" Column="10" TopLine="1110"/>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="179" Column="3" TopLine="177"/>
|
||||
</Position25>
|
||||
<Position26>
|
||||
<Filename Value="..\ushortcut.pas"/>
|
||||
<Caret Line="283" Column="55" TopLine="256"/>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="227" Column="3" TopLine="194"/>
|
||||
</Position26>
|
||||
<Position27>
|
||||
<Filename Value="..\ushortcut.pas"/>
|
||||
<Caret Line="212" Column="40" TopLine="185"/>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="179" TopLine="177"/>
|
||||
</Position27>
|
||||
<Position28>
|
||||
<Filename Value="..\ushortcut.pas"/>
|
||||
<Caret Line="255" Column="75" TopLine="235"/>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="228" TopLine="209"/>
|
||||
</Position28>
|
||||
<Position29>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="218" Column="29" TopLine="208"/>
|
||||
<Caret Line="112" TopLine="110"/>
|
||||
</Position29>
|
||||
<Position30>
|
||||
<Filename Value="..\ushortcut.pas"/>
|
||||
<Caret Line="264" Column="13" TopLine="238"/>
|
||||
<Caret Line="339" Column="67" TopLine="318"/>
|
||||
</Position30>
|
||||
</JumpHistory>
|
||||
</ProjectSession>
|
||||
|
Binary file not shown.
@ -109,7 +109,6 @@ end;
|
||||
|
||||
procedure Tmainform.FormCreate(Sender: TObject);
|
||||
begin
|
||||
LazAutoUpdate1.DebugMode:=TRUE;
|
||||
LazAutoUpdate1.VersionsININame:=C_VERSIONSINNAME;
|
||||
LazAutoUpdate1.ZipfileName:=C_ZIPFILENAME;
|
||||
LazAutoUpdate1.GitHubProjectname:='lazarusccr';
|
||||
@ -224,7 +223,7 @@ end;
|
||||
|
||||
procedure Tmainform.cmd_DeleteDesktopShortcutClick(Sender: TObject);
|
||||
begin
|
||||
LazAutoUpdate1.ShortCut.ShortCutName:='Test Application';
|
||||
LazAutoUpdate1.ShortCut.ShortCutName:=Application.Title;
|
||||
If LazAutoUpdate1.DeleteShortCut then
|
||||
ShowMessage('Success! New shortcut is toast')
|
||||
else
|
||||
|
@ -999,7 +999,7 @@ begin
|
||||
fLastError:=GetShortCutDebugString;
|
||||
if fFireDebugEvent then
|
||||
if Result = True then
|
||||
fOndebugEvent(Self, 'MakeShortCut', 'MakeShortCut succeded.')
|
||||
fOndebugEvent(Self, 'MakeShortCut', 'MakeShortCut succeded.' + GetShortCutDebugString)
|
||||
else
|
||||
fOndebugEvent(Self, 'MakeShortCut', 'MakeShortCut failed. Error(s): ' + GetShortCutDebugString);
|
||||
end;
|
||||
@ -1023,7 +1023,7 @@ begin
|
||||
|
||||
if fFireDebugEvent then
|
||||
if Result = True then
|
||||
fOndebugEvent(Self, 'MakeShortCut', 'DeleteShortCut succeded.')
|
||||
fOndebugEvent(Self, 'MakeShortCut', 'DeleteShortCut succeded.' + GetShortCutDebugString)
|
||||
else
|
||||
fOndebugEvent(Self, 'MakeShortCut', 'DeleteShortCut failed. Error: ' + GetShortCutDebugString);
|
||||
|
||||
|
Binary file not shown.
@ -9,7 +9,7 @@
|
||||
"ForceNotify" : false,
|
||||
"InternalVersion" : 1,
|
||||
"Name" : "lazupdate.lpk",
|
||||
"Version" : "0.3.5.0"
|
||||
"Version" : "0.3.6.0"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -98,7 +98,9 @@ implementation
|
||||
|
||||
var
|
||||
sDebugString: string;
|
||||
// *****************************************************************************
|
||||
// Functions and procs to aid Debugging
|
||||
// *****************************************************************************
|
||||
function GetShortCutDebugString: string;
|
||||
begin
|
||||
if (sDebugString = '') then
|
||||
@ -114,6 +116,7 @@ begin
|
||||
else
|
||||
sDebugString := sDebugString + LineEnding + '* ' + Astring;
|
||||
end;
|
||||
// *****************************************************************************
|
||||
|
||||
{$IFDEF UNIX}
|
||||
//Adapted from sysutils; Unix/Linux only
|
||||
@ -143,7 +146,7 @@ IN:
|
||||
Category: Simple string (see header of this unit)
|
||||
OUT:
|
||||
True = Success
|
||||
False = Fail
|
||||
False = Failure
|
||||
Use function GetShortCutDebugString to get most recent error as a string
|
||||
}
|
||||
var
|
||||
@ -173,19 +176,23 @@ begin
|
||||
ISLink.SetPath(PChar(Target));
|
||||
ISLink.SetArguments(PChar(TargetArguments));
|
||||
ISLink.SetWorkingDirectory(PChar(ExtractFilePath(Target)));
|
||||
// ISLink.SetIconLocation(Pchar(ExtractFilePath(Target) + IconFileName));
|
||||
{
|
||||
Not needed
|
||||
ISLink.SetIconLocation(Pchar(ExtractFilePath(Target) + IconFileName),0);
|
||||
}
|
||||
{ Get the desktop location }
|
||||
SHGetSpecialFolderLocation(0, CSIDL_DESKTOPDIRECTORY, PIDL);
|
||||
SHGetPathFromIDList(PIDL, InFolder);
|
||||
LinkName := IncludeTrailingPathDelimiter(InFolder) + ShortcutName + '.lnk';
|
||||
|
||||
{ Get rid of any existing shortcut first }
|
||||
|
||||
if not SysUtils.DeleteFile(LinkName) then
|
||||
AddToDebugString('Could not delete existing link ' + LinkName);
|
||||
{ Create the link }
|
||||
IPFile.Save(PWChar(LinkName), False);
|
||||
finally
|
||||
FreeAndNil(IPFile);
|
||||
// Not needed: FreeAndNil(IPFile);
|
||||
end;
|
||||
except
|
||||
Result := False;
|
||||
@ -197,7 +204,7 @@ end;
|
||||
function CreateDesktopShortCut(Target, TargetArguments, ShortcutName,
|
||||
IconFileName, Category: string): boolean;
|
||||
{
|
||||
* Comprehensive debugging messages in this routine.
|
||||
* Comprehensive debugging messages in this routine!
|
||||
* So many flavours of Linux.. - if no desktop icon is created then
|
||||
* call GetShortCutDebugString and log the result to a file.
|
||||
IN:
|
||||
@ -208,7 +215,7 @@ IN:
|
||||
Category: Simple string (see header of this unit)
|
||||
OUT:
|
||||
True = Success
|
||||
False = Fail
|
||||
False = Failure
|
||||
Use function GetShortCutDebugString to get errors as a string
|
||||
}
|
||||
var
|
||||
@ -222,25 +229,24 @@ begin
|
||||
Result := True;
|
||||
sDebugString := '';
|
||||
// Simple failure checks
|
||||
if not FileExistsUTF8(Target) then
|
||||
if not FileExistsUTF8(Target) then // lethal
|
||||
begin
|
||||
AddToDebugString('File "' + Target + '" cannot be located. Quitting.');
|
||||
Result := False;
|
||||
Exit;
|
||||
end;
|
||||
if not FileExistsUTF8(IconFileName) then
|
||||
if not FileExistsUTF8(IconFileName) then // non-lethal
|
||||
begin
|
||||
AddToDebugString('File "' + IconFileName + '" cannot be located. Using Target.');
|
||||
IconFileName := Target;
|
||||
end;
|
||||
if ShortCutName = '' then
|
||||
if ShortCutName = '' then // lethal
|
||||
begin
|
||||
AddToDebugString('ShortcutName is blank. Quitting.');
|
||||
Result := False;
|
||||
Exit;
|
||||
end;
|
||||
|
||||
if Category = '' then
|
||||
if Category = '' then // non-lethal
|
||||
begin
|
||||
AddToDebugString('Category is blank. Using "Utility"');
|
||||
Category := 'Utility';
|
||||
@ -250,23 +256,20 @@ begin
|
||||
sDesktopFilename := LeftStr(sDesktopFilename, 8);
|
||||
sDesktopFilename := LowerCase(sDesktopFilename);
|
||||
AddToDebugString('Desktop filename = ' + sDesktopFilename);
|
||||
// Note: IncludeTrailingPathDelimiter(ExpandFileNameUTF8('~')) resolves to '/root/'
|
||||
|
||||
// Standard path to DeskTop files
|
||||
// IncludeTrailingPathDelimiter(ExpandFileNameUTF8('~')) resolves to '/root/'
|
||||
sPathToShare := '/usr/share/applications' + DirectorySeparator +
|
||||
sDesktopFilename + '.desktop';
|
||||
// Directory check
|
||||
if not DirectoryExistsUTF8('/usr/share/applications') then
|
||||
begin
|
||||
AddToDebugString('Failure: Invalid directory - ' + '/usr/share/applications');
|
||||
Result := False;
|
||||
Exit;
|
||||
end;
|
||||
if not DirectoryExistsUTF8('/usr/share/applications') then // non-lethal
|
||||
AddToDebugString('Cannot find directory - ' + '/usr/share/applications');
|
||||
|
||||
// Temp directory path
|
||||
XdgDesktopFile := IncludeTrailingPathDelimiter(GetTempDir(False)) +
|
||||
sDesktopFilename + '.desktop';
|
||||
// Directory check
|
||||
if not DirectoryExistsUTF8(GetTempDir(False)) then
|
||||
if not DirectoryExistsUTF8(GetTempDir(False)) then // lethal
|
||||
begin
|
||||
AddToDebugString('Failure: Invalid directory - ' + GetTempDir(False));
|
||||
Result := False;
|
||||
@ -326,6 +329,14 @@ begin
|
||||
else
|
||||
AddToDebugString('Failure: Unable to delete existing ' + sPathToShare);
|
||||
end;
|
||||
// Final Directory check
|
||||
if not DirectoryExistsUTF8('/usr/share/applications') then // lethal
|
||||
begin
|
||||
AddToDebugString(
|
||||
'Failure: Directory "/usr/share/applications" does not exist on this system');
|
||||
Result := False;
|
||||
Exit;
|
||||
end;
|
||||
// Save the stringlist directly to usr/share/applications
|
||||
try
|
||||
XdgDesktopStringList.SaveToFile(sPathToShare);
|
||||
@ -342,7 +353,7 @@ begin
|
||||
end;
|
||||
if Result = False then
|
||||
try
|
||||
if Not (FileExistsUTF8(XdgDesktopFile)) then
|
||||
if not (FileExistsUTF8(XdgDesktopFile)) then
|
||||
AddToDebugString('Unable to locate temporary ' + XdgDesktopFile);
|
||||
if (FileExistsUTF8(XdgDesktopFile)) and (not FileExistsUTF8(sPathToShare)) then
|
||||
begin
|
||||
@ -358,15 +369,15 @@ begin
|
||||
[XdgDesktopFile, sPathToShare]));
|
||||
// Temp file is no longer needed....
|
||||
if not SysUtils.DeleteFile(XdgDesktopFile) then
|
||||
begin
|
||||
AddToDebugString('Failure: Unable to delete temporary ' + XdgDesktopFile);
|
||||
end;
|
||||
begin
|
||||
AddToDebugString('Failure: Unable to delete temporary ' + XdgDesktopFile);
|
||||
end;
|
||||
end;
|
||||
if (FileExistsUTF8(sPathToShare)) then
|
||||
begin
|
||||
Result:=true;
|
||||
AddToDebugString('Success: Desktop file - ' + sPathToShare);
|
||||
end;
|
||||
begin
|
||||
Result := True;
|
||||
AddToDebugString('Success: Desktop file - ' + sPathToShare);
|
||||
end;
|
||||
finally
|
||||
// Swallow, let filesystem maintenance clear it up
|
||||
end;
|
||||
@ -383,7 +394,7 @@ var
|
||||
InFolder: array[0..MAX_PATH] of char;
|
||||
LinkName: WideString;
|
||||
begin
|
||||
Result := False;
|
||||
Result := False; // Assume failure; look for success
|
||||
sDebugString := '';
|
||||
try
|
||||
{ Get the desktop location }
|
||||
@ -391,7 +402,12 @@ begin
|
||||
SHGetPathFromIDList(PIDL, InFolder);
|
||||
LinkName := IncludeTrailingPathDelimiter(InFolder) + ShortcutName + '.lnk';
|
||||
if SysUtils.DeleteFile(LinkName) then
|
||||
begin
|
||||
Result := True;
|
||||
AddToDebugString('DeleteDesktopShortcut Success: Deleted ' + LinkName);
|
||||
end
|
||||
else
|
||||
AddToDebugString('DeleteDesktopShortcut Failure: Unable to delete ' + LinkName);
|
||||
except
|
||||
AddToDebugString('Exception deleting ' + LinkName);
|
||||
// Eat the exception
|
||||
|
Reference in New Issue
Block a user