vista wxMkdir Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
spectrum
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 207
Joined: Sat Jul 21, 2007 12:17 pm

vista wxMkdir

Post by spectrum » Tue Jul 07, 2009 9:54 am

hello all,

i need some help with a probaly classic rights/security Vista issue.
I designed my application that in case of some events, i write some messages in a log.txt (i create the folder/file if it not exist).

I decided to create it in the application path:

C:\Program Files\MyApp\bin\archive\logs\log.txt"

So first of all i create the "logs" folder if missing, then i create the file.

All work fine in XP, until Vista "unfortunate" improvements.

On vista, wxMkdir issue a dialogbox the following error:

Code: Select all

Directory 'C:\Program Files\MyApp\bin/archive//logs/" couldn't be created (error 183: cannot create a file when that file already exist)"
Now the mistery: no "logs" folder was existing or has been created at all in any place, "search" don't find nothing in all "C:\".
I suspect on some vista rights issue.

Every help is very appreciated.
spectrum

User avatar
doublemax
Moderator
Moderator
Posts: 15262
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Post by doublemax » Tue Jul 07, 2009 10:32 am

unless you're running as Administrator, you don't have write access to the "program files" directory (not even your own) and you shouldn't do that.

Use wxStandardPaths::GetUserLocalDataDir (or whatever directory fits better)

And if you try to write to it, Vista's directory virtualization will step in and redirect the access to another directory.
C:\Users\Username\AppData\Local\VirtualStore\Program Files\

http://msdn.microsoft.com/en-us/library/bb756960.aspx
Use the source, Luke!

spectrum
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 207
Joined: Sat Jul 21, 2007 12:17 pm

Post by spectrum » Thu Jul 16, 2009 1:32 pm

many thanks !
spectrum

Auria
Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am
Contact:

Post by Auria » Thu Jul 16, 2009 2:10 pm

Please accept the post that helped you and not yours. Thanks
"Keyboard not detected. Press F1 to continue"
-- Windows

Post Reply