Forum moved here!

Home / -config-path option for portable SumatraPDF

Proger

Hello!
First, thank very much to the developers for a great and free tool!
I am using SumatraPDF as a viewer with “Altap Salamander” file manager, and I have a question:

Is it possible to add an option (like “-config-path”) for the portable version to specify the exact location of the configuration file?

Because SumatraPDF runs as plug-in from Salamander, it’s good to pass the correct path to the configuration file, and great, if all configuration changes to also save in it.
I tried putting the configuration file near SumatraPDF.exe, but it doesn’t work if SumatraPDF is inside %ProgramFiles% (or in nested folders). I have it in %ProgramFiles%\Altap Salamander\ext-viewers\SumatraPDF\SumatraPDF-settings.txt and it’s not working, still creating a configuration file in %localappdata%\SumatraPDF…

GitHubRulesOK

The portable version (single .exe) will always use its own folder for settings, but you must have User Access Control rights to write to that folder. However, if you wish, you can also specify an alternative appdata folder.

Try “Path to\SumatraPDF.exe” -appdata “Path to\FolderName” containing SumatraPDF-settings.txt

e.g. -appdata “%ProgramFiles%\Altap Salamander\ext-viewers\SumatraPDF”

Your UAC elevation or the folder properties security may need changing to allow you to make editor changes in said folder\file. Hence by default it is saved in your personal %localappdata%\SumatraPDF which should not be a problem for 99.9% of users

Proger

It’s worked!
But, Salamander can’t send relative path for external plugin/viewer .exe, it work only with absolute path (can change with portable use of Salamander)…
Is it possible to send with -appdata path to Sumatra’s executable?

What I don’t understand is why it check for a .exe inside %program files% when it’s more logical, if configuration file in the same folder as the SumatraPDF.exe, to take parameters from it rather than from %localappdata%? :frowning:

GitHubRulesOK

Am slightly confused by your usage.
Using Sumatra portable from elsewhere (e.g. portableapps version) may cause problems. ONLY use the ones from https://www.sumatrapdfreader.org/download-free-pdf-viewer.html NO OTHER, they may mess with the defaults, and behave as you describe.

Portable should not normally be in “program files” since that is a more restrictive area

Most users would either be using a portableapps directory on a usb drive or a dedicated c:\portableapps or similar folder (avoid using dropbox / google drive or similar)

The dedicated portable versions expect to be in a read/write directory without the need to run as admin, and in that case they use their own directory for data including crash folder and cache. Then there is no need to specify -appdata.

The use of %variable% depends how your system is configured so -appdata can be different for portable use on different drives or say you need one startup to be different to another, but remember two settings = two histories.

The simplest way to control portable settings is use a cmd file to detect running drive and self adjust the appdata settings if needed. however Altap Salamander seems to accept enviroment settings. So you should be able to use one during start up if necessary. I had no problem using a portable altap on one drive with a portable from this site on another using fixed locations but did not try relative variables as I just wanted to check for the default settings file in the exe dir.

Just to check env vars work I set pdf F3 action to work with an old one I use $[MOZ_PLUGIN_PATH]

image

and got the expected older version which then saved its settings in its own folder no hint of any appdata at all