Difference between getApplicationPath() and getLaunchPath()

Discussion forum for C++ and script developers who are using the QCAD development platform or who are looking to contribute to QCAD (translations, documentation, etc).

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files, scripts and screenshots.

Post one question per topic.

Post Reply
CVH
Premier Member
Posts: 3416
Joined: Wed Sep 27, 2017 4:17 pm

Difference between getApplicationPath() and getLaunchPath()

Post by CVH » Mon Sep 27, 2021 11:49 am

Andrew,

Fixing:
https://qcad.org/rsforum/viewtopic.php?t=8688
https://qcad.org/rsforum/viewtopic.php?t=7726
https://www.ribbonsoft.com/bugtracker/i ... sk_id=2128

What are the differences between RSettings.getApplicationPath() and RSettings.getLaunchPath()?

When can these values be different from each other?
On a windows system I get twice the same value pointing to the 'C:/Program Files' folder.

Regards,
CVH

User avatar
andrew
Site Admin
Posts: 9037
Joined: Fri Mar 30, 2007 6:07 am

Re: Difference between getApplicationPath() and getLaunchPath()

Post by andrew » Mon Sep 27, 2021 4:22 pm

The difference is mostly relevant for command line tools.

If QCAD is started for example like this:

Code: Select all

cd /home/user
./opt/qcad-3.26.4-pro-linux-x86_64/qcad
The launch path would be /home/user
The application path would be /home/user/opt/qcad-3.26.4-pro-linux-x86_64

The launch path is relevant for command line arguments. Consider:

Code: Select all

cd /home/user
./opt/qcad-3.26.4-pro-linux-x86_64/qcad myfile.dxf
myfile.dxf would have to be under:

Code: Select all

/home/user/myfile.dxf
And not:

Code: Select all

/home/user/opt/qcad-3.26.4-pro-linux-x86_64/myfile.dxf

CVH
Premier Member
Posts: 3416
Joined: Wed Sep 27, 2017 4:17 pm

Re: Difference between getApplicationPath() and getLaunchPath()

Post by CVH » Mon Sep 27, 2021 5:59 pm

Thanks,
makes sense in the explained example.

It doesn't on a Windows system there C:/Program Files/QCAD/qcad.exe as command returns:
'C:/Program' is not recognized as an internal or external command, operable program or batch file.

There I start QCAD from a link on my destop shouldn't the launch path then be the user desktop folder?

Related to the use:
I presume CreateLibraryItem.js is not run as a command line tool as it requires a document, a selection and an export file name.
I tweaked it so that it retrieves the last used path or the user data location folder or finally revert to the launch path as original.

The launch path under Program Files on a Windows system is of no use as one can't write to it.

Regards,
CVH

User avatar
andrew
Site Admin
Posts: 9037
Joined: Fri Mar 30, 2007 6:07 am

Re: Difference between getApplicationPath() and getLaunchPath()

Post by andrew » Mon Sep 27, 2021 8:33 pm

CVH wrote:
Mon Sep 27, 2021 5:59 pm
It doesn't on a Windows system there C:/Program Files/QCAD/qcad.exe as command returns:
'C:/Program' is not recognized as an internal or external command, operable program or batch file.
You'd have to escape the space, presumably with a backslash (or slash) or use quotes around the path.

CVH
Premier Member
Posts: 3416
Joined: Wed Sep 27, 2017 4:17 pm

Re: Difference between getApplicationPath() and getLaunchPath()

Post by CVH » Tue Sep 28, 2021 8:24 am

Andrew,

With quotes it works, thanks, but that is not the point.
The topic here is that CreateLibraryItem.js writes new items to the launch path. Hard coded.
https://www.ribbonsoft.com/bugtracker/i ... sk_id=2128

I tweaked a copy of the script. Functional, not that I use library items.

Regards,
CVH

Post Reply

Return to “QCAD Programming, Script Programming and Contributing”