Hi,
Today I encounter some issue when making a portable application.
There is a path storing in registry, and I use ConfigWrite to modify the path.
However, the registry imported is only the old one. The path is changed, but only changed in the file, instead of the real registry. When I close the application, the old registry values are exported to the registry file. Then the entire ConfigWrite doesn't work.
How can I write data first, and after that, import registry?
Here is the launcher.ini I used:
[Launch]
AppName=JPEGsnoopPortable
ProgramExecutable=JPEGsnoop\JPEGsnoop.exe
SingleAppInstance=true
DirectoryMoveOK=yes
[Activate]
Registry=true
[FileWrite1]
File=%PAL:DataDir%\settings\JPEGsnoop.reg
Type=ConfigWrite
Entry="UserDbPath"=
Value="%PAL:DataDir:DoubleBackslash%\\JPEGsnoop"
[RegistryKeys]
JPEGsnoop=HKCU\Software\ImpulseAdventure\JPEGsnoop
[RegistryCleanupIfEmpty]
1=HKCU\Software\ImpulseAdventure
Thanks for helping.
Registry files are written to as INI files, not config files.
Sometimes, the impossible can become possible, if you're awesome!
Hi,
I like to know what is the difference between using [RegistryValueWrite] and [FileWriteN] for the above example?
Are the following two equivalent?
[RegistryValueWrite]
HKCU\Software\ImpulseAdventure\JPEGsnoop\UserDbPath=REG_SZ:%PAL:DataDir%\JPEGsnoop
[FileWrite1]
Type=INI
File=%PAL:DataDir%\settings\JPEGsnoop.reg
Section=HKCU\Software\ImpulseAdventure\JPEGsnoop
Key="UserDbPath"
Value="%PAL:DataDir:DoubleBackslash%\\JPEGsnoop"
FileWrite happens to the reg file before that registry file is imported into the registry. It's how we usually do things as most of what we do is replacing one path with another (aka portablizing paths from the last run location to the current one). RegistryValueWrite isn't used in any of the 300+ apps we have released and I'm not sure when that write happens with respect to a reg file import.
Sometimes, the impossible can become possible, if you're awesome!
I like to use [RegistryValueWrite] because I can copy the value exactly from Regedit and need not to add double quotation mark nor change single slash to double slash. It is easier to learn and it seems work as I want.
Ok. I finally use Type=INI and it was tackled.
So one last question: which kind of files I can use Type=ConfigWrite?
They're used for config files. These are like INI files except they have no section names and don't necessarily use equal signs to delineate between key and value. You'll know it when you run across it.
Sometimes, the impossible can become possible, if you're awesome!