Recent

Author Topic: (SOLVED) Create crossplatform shortcut  (Read 2102 times)

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
(SOLVED) Create crossplatform shortcut
« on: September 05, 2018, 03:53:39 pm »
Create a link on the desktop. Hi guys, can anyone tell me how to crossplatform a link from a file to the desktop?

Let's assume that in /home/test/ we have the myapp program and we want to create a shortcut on the desktop. How to do it, so that it works even if the file was in c:\test\?
« Last Edit: September 20, 2018, 08:40:05 am by xinyiman »
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: Create crossplatform shortcut
« Reply #1 on: September 05, 2018, 05:50:31 pm »
Create a link on the desktop. Hi guys, can anyone tell me how to crossplatform a link from a file to the desktop?

Let's assume that in /home/test/ we have the myapp program and we want to create a shortcut on the desktop. How to do it, so that it works even if the file was in c:\test\?
that is a process for the installer/setup of your program not your program. In any case there is no way to do that cross platform, in linux alone depends on the window manager used some might not even allow links on the desktop. For windows you can study the source code of Inno setup application to see how.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: Create crossplatform shortcut
« Reply #2 on: September 05, 2018, 05:52:42 pm »
AFAIK, there's no consistent cross-platform way to do it. Your best (only?) bet is to program a function/proc for each platform and use $IFDEF to compile the correct one in each.
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

balazsszekely

  • Guest
Re: Create crossplatform shortcut
« Reply #3 on: September 05, 2018, 06:09:28 pm »
Create a link on the desktop. Hi guys, can anyone tell me how to crossplatform a link from a file to the desktop?

Let's assume that in /home/test/ we have the myapp program and we want to create a shortcut on the desktop. How to do it, so that it works even if the file was in c:\test\?
Fpcupdeluxe does create a link on the desktop and it works fine in every major platform. Download the source then study unit fpcuputil, method CreateDesktopShortCut.   
« Last Edit: September 05, 2018, 06:12:18 pm by GetMem »

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
Re: Create crossplatform shortcut
« Reply #4 on: September 20, 2018, 08:39:54 am »
Create a link on the desktop. Hi guys, can anyone tell me how to crossplatform a link from a file to the desktop?

Let's assume that in /home/test/ we have the myapp program and we want to create a shortcut on the desktop. How to do it, so that it works even if the file was in c:\test\?
Fpcupdeluxe does create a link on the desktop and it works fine in every major platform. Download the source then study unit fpcuputil, method CreateDesktopShortCut.
Is perfetc. Thank you
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

 

TinyPortal © 2005-2018