See subject.
I tried
%userappdata%\mycompany\myproduct\bug_report.txt
Report is saved in
C:\users\<user>\appdata\roaming\mycompany\myproduct\bug_report.txt
Also tried
%localappdata%
Does not work, it is not decoded.
Report is saved in
<DirOfExe>\%localappdata%\mycompany\myproduct\bug_report.txt
In the line above %localappdata% is a real directory, not a placeholder.
This hack works (tested on Windows 7 only):
%userappdata%\..\local\mycompany\myproduct\bug_report.txt
What is the correct way?
TIA
Stefan
Save bug report under C:\users\<user>\appdata\local\
Re: Save bug report under C:\users\<user>\appdata\local\
madExcept interprets those vars as follows:
I'm not sure why it results in such weird paths in your case. In any case, you can specify any path you want at runtime, by doing this:
Code: Select all
ReplaceTextW(str, '%desktop%', GetSpecialFolderW(CSIDL_DESKTOPDIRECTORY, false));
if PosTextW('%userappdata%', str) > 0 then
ReplaceTextW(str, '%userappdata%', GetSpecialFolderW(CSIDL_APPDATA, false));
if PosTextW('%commonappdata%', str) > 0 then
ReplaceTextW(str, '%commonappdata%', GetSpecialFolderW(CSIDL_COMMON_APPDATA, false));
Code: Select all
uses ..., madExcept;
initialization
MESettings().BugReportFile := 'c:\whateverPathYouLike\bugreport.mbr';
Re: Save bug report under C:\users\<user>\appdata\local\
Mathias,
can you add this:
if PosTextW('%localappdata%', str) > 0 then
ReplaceTextW(str, '%localappdata%', GetSpecialFolderW(CSIDL_LOCAL_APPDATA, false));
That's what I need![wink ;-)](./images/smilies/icon_wink.gif)
For the time being I will use the runtime approach...
All the best
Stefan
can you add this:
if PosTextW('%localappdata%', str) > 0 then
ReplaceTextW(str, '%localappdata%', GetSpecialFolderW(CSIDL_LOCAL_APPDATA, false));
That's what I need
![wink ;-)](./images/smilies/icon_wink.gif)
For the time being I will use the runtime approach...
All the best
Stefan
Re: Save bug report under C:\users\<user>\appdata\local\
Great, thanks!