I saw that many apps require %PAL:PortableAppsBaseDir% to replace paths stored in settings files. However why it will not work if I only use %PAL:Drive% and %PAL:LastPackagePartialDir% to replace the old paths (why we have to add %PAL:PortableAppsBaseDir% to ensure paths are modified correctly)?
You are here
About %PAL:PortableAppsBaseDir%
PackagePartial is for replacing paths within the app's directory. And Drive is for replacing drive letters. PortableAppsBase is for replacing things relative to the PortableApps directory (where Start.exe lives). This directory may not be the root of the drive for folks who install in DropBox or similar. This entire path will change between PCs for folks who sync (different OS means a different base of Documents and Settings or Users and the login could be different). PortableAppsBase allows replacement of paths to the Documents, Documents\Music, etc directories, so the recently opened files list and similar can be updated in these situations.
John T. Haller wrote ...
PackagePartial is for replacing paths within the app's directory.
Can you demonstrate the necessity and usefulness on a concrete example of an app?
I just explained a concrete example. Any app that you use in a synced DropBox account will necessarily have different paths on each computer. And you're syncing a path to a document that is not within the app's folder and not on the same path relative to the drive letter but IS relative to the PortableAppsBase directory (not the AppNamePortable directory, not the PortableApps directory, but the directory one level above that that contains the PortableApps and Document directories as well as Start.exe). It's so you can have paths to things in Documents and similar be adjusted between PCs synced using a cloud drive. So that file you opened from your Documents directory in whatever app still shows in your recent files list in whatever app when you switch from your DropBox-synced Windows 7 laptop to your DropBox-synced Windows XP desktop and still opens when you select it. Without PortableAppsBase, this would be impossible without custom-configuring your synced DropBox folder to be the same relative path from root on each PC.