Creating files/folders on Windows 7

For questions about using Classic.

Post » Thu May 13, 2010 10:49 am

If you right click and 'Run as administrator', does it work? Windows Vista/7 have protected file systems, so if you try to write to a protected directory (eg. in Program Files), access is denied unless the application has administrative privileges. For example if your game is installed to Program Files and tries to write files to its own folder, it will be denied access.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,630

Post » Thu May 13, 2010 11:09 am

[quote="Ashley":2nrv9d0u]If you right click and 'Run as administrator', does it work? Windows Vista/7 have protected file systems, so if you try to write to a protected directory (eg. in Program Files), access is denied unless the application has administrative privileges. For example if your game is installed to Program Files and tries to write files to its own folder, it will be denied access.[/quote:2nrv9d0u]

For that exact reason, the current version of the game tries to write the files to My Documents, like a lot of commercial games do. It works fine on Vista and XP, but not at all on 7, even with admin privileges. I thought it might have to do with the fact that 7 structures its folders differently, but I'm not sure.
B
2
G
3
Posts: 50
Reputation: 950

Post » Thu May 13, 2010 11:38 am

So, either I make the game create its files in AppPath, meaning the player needs admin privileges (given that most players are likely to install the game in Program Files), or... what else could I do?

Would it make sense to just have the game create a save games folder in C?
B
2
G
3
Posts: 50
Reputation: 950

Post » Thu May 13, 2010 12:09 pm

The folder "my documents" (hope it is called so in english^^) is the default storage location for saved files. It should be writable without admin rights.
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Thu May 13, 2010 12:26 pm

Access to C:\ is also blocked by Windows, so it doesn't even solve the problem. Besides, having a program write anything to C:\ is obnoxious to the user, and always has been a bad idea.

The best candidate is probably the user's AppData folder which applications are allowed access to, or you could settle for My Documents if necessary.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,630

Post » Thu May 13, 2010 1:32 pm

[quote="tulamide":1epep42r]The folder "my documents" (hope it is called so in english^^) is the default storage location for saved files. It should be writable without admin rights.[/quote:1epep42r]

Yes, but Construct seems to be having problems writing to MyDocuments on Windows 7, probably because Windows 7 has different folder structures.
B
2
G
3
Posts: 50
Reputation: 950

Post » Thu May 13, 2010 6:15 pm

[quote="Ashley":1jwpqx0u]
The best candidate is probably the user's AppData folder which applications are allowed access to, or you could settle for My Documents if necessary.[/quote:1jwpqx0u]

AppData seems to be the way to go. Thanks for the tip!
B
2
G
3
Posts: 50
Reputation: 950

Previous

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 3 guests