Set registry to control working dir when associating file-type with application

Posted by John on Stack Overflow See other posts from Stack Overflow or by John
Published on 2010-04-21T22:27:51Z Indexed on 2010/04/21 22:33 UTC
Read the original article Hit count: 174

I'm using Inno for an installer, and I want to associate a file type with my app:

Root: HKCR; Subkey: ".rpl"; ValueType: string; ValueName: ""; ValueData: "MyReplay"; Flags: uninsdeletevalue;
Root: HKCR; Subkey: "MyReplay"; ValueType: string; ValueName: ""; ValueData: "Replay File"; Flags: uninsdeletekey;
Root: HKCR; Subkey: "MyReplay\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\bin\MyApp.ico,0"; Flags: uninsdeletekey;
Root: HKCR; Subkey: "MyReplay\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\bin\MyApp.exe"" ""%1"""; Flags: uninsdeletekey;

Right now, double-clicking a .rpl file launches the app, but the working dir appears to be where the .rpl file is located, so the app crashes as it can't load any data. Is it posible to set the registry to control the start/working dir for file associations as well as the app that is launched? Or does my app itself need to be able to work around this?

© Stack Overflow or respective owner

Related posts about file-association

Related posts about inno-setup