Forum moved here!

Home / Is it possible to let the FilePath a relative path?

a14907

The FilePath under FileStates in SumatraPDF-settings.txt file is a absolute path!
Is it possible be a relative path? So I can copy the exe and SumatraPDF-settings.txt file to a directory in flash drive and put some file in a directory near the exe. So I can take it everywhere and recover the reading history.

GitHubRulesOK

Not easily as there are several problems with using replacement paths, it is difficult to know if a user has multiple copies in similar folders so C:\books\accounts.pdf is kept separate entry from RAMdrive z:\books\accounts.pdf OR usb f:\books\accounts.pdf OR http://www.example.com /books/accounts.pdf or \\myserver\books\accounts.pdf since one or all may be temporarily detached and reappear a minute later. So for reliability must be persistent (hence a request to remove non working entries as soon as they are not needed e.g. should be removed when the portable copy is moved to another PC !!, the opposite to what you want).

There is no feedback from windows about drives mount / unmount names changing especially for portable usage.

The traditional way for portable users with absolute.ini files is to either have separate history profiles (SumatraPDF has -appdata command) or use a utility to replace one drive letter with another in the ini file (in this case summatrapdf-settings.txt)

For this use case I suggest overwriting the drive letters would in most cases work best rather that separate -appdata histories. That would also apply to Session Data too. Avoid utilities that keep different portable configurations unless they only edit the drive url to another mount point such as another drive url.

To see a short CMD approach (requires a small find&replace.exe) to make the changes modify the solution towards end of How to automate opening a PDF from an external drive when the drive letter varies? - #2 by GitHubRulesOK

kjk

@a14907 This already works.

When you open a file we will match settings by file name, not full path. This means if you open a file, close, move it in file system, and open again, the setting from first opening are preserved.

Not sure when I added this behavior, could only be available in latest pre-release https://www.sumatrapdfreader.org/prerelease

a14907

Great job! prerelease satisfy my demand. where to close this issue?

kjk

No need to close, this discussion thread might be useful to someone in the future.

DesolationIsland

:kissing_heart: :kissing_heart: :kissing_heart: That’s a surprise