diff --git a/components/lazautoupdate/latest_stable/lazupdate.lpk b/components/lazautoupdate/latest_stable/lazupdate.lpk index ae0c73cdb..8a18a41c9 100644 --- a/components/lazautoupdate/latest_stable/lazupdate.lpk +++ b/components/lazautoupdate/latest_stable/lazupdate.lpk @@ -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. "/> - + diff --git a/components/lazautoupdate/latest_stable/testapp/testapp.lpi b/components/lazautoupdate/latest_stable/testapp/testapp.lpi index 6965821fc..b32364ca3 100644 --- a/components/lazautoupdate/latest_stable/testapp/testapp.lpi +++ b/components/lazautoupdate/latest_stable/testapp/testapp.lpi @@ -19,13 +19,14 @@ + - + - + @@ -127,6 +128,11 @@ + + + + + diff --git a/components/lazautoupdate/latest_stable/testapp/testapp.lps b/components/lazautoupdate/latest_stable/testapp/testapp.lps index 350dc2978..70772f1dd 100644 --- a/components/lazautoupdate/latest_stable/testapp/testapp.lps +++ b/components/lazautoupdate/latest_stable/testapp/testapp.lps @@ -4,13 +4,13 @@ - + - + @@ -19,9 +19,9 @@ - - - + + + @@ -32,7 +32,7 @@ - + @@ -42,15 +42,14 @@ - - - - + + + - - - + + + @@ -58,7 +57,7 @@ - + @@ -141,11 +140,11 @@ - + - + @@ -187,9 +186,9 @@ - - - + + + @@ -202,9 +201,9 @@ - - - + + + @@ -212,7 +211,7 @@ - + @@ -227,7 +226,7 @@ - + @@ -241,7 +240,7 @@ - + @@ -250,7 +249,7 @@ - + @@ -258,7 +257,7 @@ - + @@ -266,7 +265,7 @@ - + @@ -274,9 +273,19 @@ - + + + + + + + + + + + @@ -284,123 +293,123 @@ - + - + - + - + - + - - + + - + - - + + - + - + - - + + - + - + - - + + - - + + - + - + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - + diff --git a/components/lazautoupdate/latest_stable/testapp/testapp.res b/components/lazautoupdate/latest_stable/testapp/testapp.res index 193ea8aa1..3a2d1f4d6 100644 Binary files a/components/lazautoupdate/latest_stable/testapp/testapp.res and b/components/lazautoupdate/latest_stable/testapp/testapp.res differ diff --git a/components/lazautoupdate/latest_stable/testapp/umainform.pas b/components/lazautoupdate/latest_stable/testapp/umainform.pas index 335fd7672..794629f2b 100644 --- a/components/lazautoupdate/latest_stable/testapp/umainform.pas +++ b/components/lazautoupdate/latest_stable/testapp/umainform.pas @@ -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 diff --git a/components/lazautoupdate/latest_stable/ulazautoupdate.pas b/components/lazautoupdate/latest_stable/ulazautoupdate.pas index ad14449b4..4d9f2cafe 100644 --- a/components/lazautoupdate/latest_stable/ulazautoupdate.pas +++ b/components/lazautoupdate/latest_stable/ulazautoupdate.pas @@ -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); diff --git a/components/lazautoupdate/latest_stable/updates/lazautoupdate.zip b/components/lazautoupdate/latest_stable/updates/lazautoupdate.zip index 54a2d1ea9..1cdd8980b 100644 Binary files a/components/lazautoupdate/latest_stable/updates/lazautoupdate.zip and b/components/lazautoupdate/latest_stable/updates/lazautoupdate.zip differ diff --git a/components/lazautoupdate/latest_stable/updates/update_lazautoupdate.json b/components/lazautoupdate/latest_stable/updates/update_lazautoupdate.json index 94f26b167..cf884dd5f 100644 --- a/components/lazautoupdate/latest_stable/updates/update_lazautoupdate.json +++ b/components/lazautoupdate/latest_stable/updates/update_lazautoupdate.json @@ -9,7 +9,7 @@ "ForceNotify" : false, "InternalVersion" : 1, "Name" : "lazupdate.lpk", - "Version" : "0.3.5.0" + "Version" : "0.3.6.0" } ] } diff --git a/components/lazautoupdate/latest_stable/ushortcut.pas b/components/lazautoupdate/latest_stable/ushortcut.pas index 9e3e3d97f..6bf4e51e0 100644 --- a/components/lazautoupdate/latest_stable/ushortcut.pas +++ b/components/lazautoupdate/latest_stable/ushortcut.pas @@ -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