Get Far installation path

A place where plug-in developers can share their knowledge and experience.
User avatar
techie
Posts: 712
Joined: Mon 03 Oct, 2005 22:42
Has thanked: 22 times
Been thanked: 2 times

Get Far installation path

Postby techie » Sun 09 Jan, 2011 11:48

How to get path to Far installation from registry, i.e. for external tool or plugin installer?

Maximus5
Posts: 3291
Joined: Sun 11 Nov, 2007 02:03
Been thanked: 4 times
Contact:

Re: Get Far installation path

Postby Maximus5 » Sun 09 Jan, 2011 12:07

Use %FARHOME% env.var, when external tool is started from Far
, imho, is not safe - Far may not be installed, but simply unpacked.

User avatar
techie
Posts: 712
Joined: Mon 03 Oct, 2005 22:42
Has thanked: 22 times
Been thanked: 2 times

Re: Get Far installation path

Postby techie » Sun 09 Jan, 2011 12:37

Thanks. I couldn't find this myself, because it appeared that I've entered wrong search parameters. I actually found Far2 installation key in HKLM/Software/Far2/InstallDir, but I've installed Far2 for all users, and I am not sure if the same key will be created in HKCU. I am also not sure if Far 1.7x create keys in the same manner.

Uninstaller key has a different name in my case and I am afraid that it can not be used reliably HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{514B211A-E883-4F8D-B783-D0393E2E1CA5}

User avatar
chupakabra
Posts: 1024
Joined: Wed 27 Jul, 2005 19:36
Contact:

Re: Get Far installation path

Postby chupakabra » Sun 09 Jan, 2011 13:38

You can see example plugin installer here: http://code.google.com/p/farplug/source ... Finstaller

User avatar
techie
Posts: 712
Joined: Mon 03 Oct, 2005 22:42
Has thanked: 22 times
Been thanked: 2 times

Re: Get Far installation path

Postby techie » Sun 09 Jan, 2011 15:22

Thanks. I already have working installer. I just need a mechanism for reliably detecting Far installation without redundant stuff.

User avatar
chupakabra
Posts: 1024
Joined: Wed 27 Jul, 2005 19:36
Contact:

Re: Get Far installation path

Postby chupakabra » Sun 09 Jan, 2011 18:03

Far installer saves installation path into the following registry parameter:
HKLM (per-machine install) or HKCU (per-user install)
Software
Far (for Far 1.75) or Far2 (for Far 2)
InstallDir (for x86) or InstallDir_x64 (for Far x64)

Example:
Far 2 x64 per-machine installation: HKLM\Software\Far2\InstallDir_x64

When installing x64 plugin using x86 installer (and vice versa) you should take registry virtualization into account (per-machine install only).

Btw. Far installer is open source.

User avatar
techie
Posts: 712
Joined: Mon 03 Oct, 2005 22:42
Has thanked: 22 times
Been thanked: 2 times

Re: Get Far installation path

Postby techie » Sun 09 Jan, 2011 18:38

Thanks. I ended up with the following lookup order:

HKCU Software/Far2 InstallDir
HKLM Software/Far2 InstallDir
%PROGRAMFILES%\Far2
HKCU Software/Far InstallDir
HKLM Software/Far InstallDir
%PROGRAMFILES%\Far

What is this "registry virtualization"?

User avatar
chupakabra
Posts: 1024
Joined: Wed 27 Jul, 2005 19:36
Contact:

Re: Get Far installation path

Postby chupakabra » Sun 09 Jan, 2011 19:16

What is this "registry virtualization"?

32-bit application will read from HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Far2\InstallDir_x64 instead of HKEY_LOCAL_MACHINE\SOFTWARE\Far2\InstallDir_x64 by deafult.

User avatar
DrKnS
Posts: 4503
Joined: Thu 04 Aug, 2005 06:44
Location: Kyiv
Has thanked: 2 times
Been thanked: 111 times
Contact:

Re: Get Far installation path

Postby DrKnS » Sun 09 Jan, 2011 21:07

techie wrote:%PROGRAMFILES%

Don't forget about %ProgramFiles(x86)%.

User avatar
techie
Posts: 712
Joined: Mon 03 Oct, 2005 22:42
Has thanked: 22 times
Been thanked: 2 times

Re: Get Far installation path

Postby techie » Sun 09 Jan, 2011 22:57

I've placed NSIS sources to https://sourceforge.net/apps/trac/color ... eadist.nsi
Feel free to send a patch if the installer from https://sourceforge.net/projects/colore ... rer-1.0.3/ won't work correctly.


Return to “Plug-In Developers”

Who is online

Users browsing this forum: No registered users and 1 guest