Opened 18 years ago

Closed 18 years ago

Last modified 6 years ago

#8549 closed patch

Possible scummvm.ini location fix

Reported by: vinterstum Owned by: Kirben
Priority: normal Component: Port: Win32
Version: Keywords:
Cc: Game:

Description

This patch builds on [1476081]: Patch for relocating scummvm.ini on NT systems.

The searchorder for scummvm.ini on Windows after this patch would be:

1) Look for it in the current directory 2) Look for it in the Windows directory 3) If we're not running on 9x, use the APPDATA\ScummVM directory (Usually something like c:\Documents and Settings\username\Application Data\ScummVM). If we're running on 9x, fall back to 2).

Ticket imported from: #1511993. Ticket imported from: patches/654.

Attachments (5)

scummvm-win-inifix.diff (1.4 KB ) - added by vinterstum 18 years ago.
scummvm.ini location patch
scummvm-win-inifix_v2.diff (1.4 KB ) - added by vinterstum 18 years ago.
Patch v2, missed the actual version check.
scummvm-win-inifix_v3.diff (1.6 KB ) - added by vinterstum 18 years ago.
scummvm-win-inifix_v4.diff (1.7 KB ) - added by vinterstum 18 years ago.
Patch v4: Fallbacks and such
scummvm-win-inifix_v5.diff (2.0 KB ) - added by Kirben 18 years ago.
Patch v5: Added suggestions

Download all attachments as: .zip

Change History (16)

by vinterstum, 18 years ago

Attachment: scummvm-win-inifix.diff added

scummvm.ini location patch

by vinterstum, 18 years ago

Attachment: scummvm-win-inifix_v2.diff added

Patch v2, missed the actual version check.

comment:1 by Kirben, 18 years ago

There is no need to look in the current directory at all, as it offers no advantage over current method.

The reading of APPDATA enviromental variable isn't safe, as you assume it must always exist. I don't think it would be set on Windows NT4.

For Windows NT4, you would need to check %USERPROFILE% \Application Data

by vinterstum, 18 years ago

Attachment: scummvm-win-inifix_v3.diff added

comment:2 by vinterstum, 18 years ago

You're right about N4, new patch attached. APPDATA should work for all version from Win2k and upwards.

I'm not sure I agree about the current directory, though. I can see one scenario where a scummvm.ini in the current dir would be helpful (on a CD), but can't really see any reason NOT to check for it. Of course the -c option can always be used, but it's an extra step that I don't see the need for in this instance.

comment:3 by Kirben, 18 years ago

Allowing the config file to be stored in different locations, could lead to confusion. If a config file exists in both locations, one config file will override the settings of the other, depending on the search order.

As you mentioned, there is already an override available, which can be used if ScummVM is been used on read only media or if user wants a custom location.

comment:4 by vinterstum, 18 years ago

My reasoning is simply enough that if a user places a scummvm.ini file in the same directory as scummvm.exe, he'll want that one to be read by default. To me, that's logical program behaviour; ignoring it and looking elsewhere would not be.

Any actual Windows design guidelines on this?

comment:5 by Kirben, 18 years ago

The current Microsoft guidelines are to store configuration files in C:\Documents and Settings\username\Application Data\program\ for recent Windows versions. I'm not sure about the Microsoft guidelines, before they offered that method.

Also the 'Application Data' directory might not exist on Windows NT4, shouldn't there be an additinal CreateDirectory () for that, if required?

comment:6 by vinterstum, 18 years ago

There should be another CreateDirectory yep, I'm just trying to research in which scenarios APPDATA or USERPROFILE wouldn't be set before I update the patch any further :).

by vinterstum, 18 years ago

Attachment: scummvm-win-inifix_v4.diff added

Patch v4: Fallbacks and such

comment:7 by vinterstum, 18 years ago

V4: Creates USERPROFILE\Application Data if not there, and falls back to the windows directory if APPDATA or USERPROFILE aren't defined.

Also removed the checking of the current directory until I get feedback from more people about it :).

comment:8 by fingolfin, 18 years ago

Ref: See also patch #1476081 and feature request #743288.

by Kirben, 18 years ago

Attachment: scummvm-win-inifix_v5.diff added

Patch v5: Added suggestions

comment:9 by Kirben, 18 years ago

Owner: set to Kirben
Status: newclosed

comment:10 by Kirben, 18 years ago

I added patch to ScummVM SVN, with minor changes.

On Windows NT/2000/XP/Vista, the search order is: 1) Look for config file in the 'Application Data\ScummVM' directory of the user's profile 2) Look for config file in the Windows directory

An error is triggered, if we are unable to locate the 'Application Data' directory of the user profile.

The default config file location is the the 'Application Data\ScummVM' directory of the user's profile, if no config file exists.

The location of config file been used, is reported in console window of ScummVM on startup, so it is clear which config file is been used.

I think a forced move of config file data to the new location would be best avoided. It is better if we leave it up to users, to choose whether they want to keep current config file location, or move the config file to the new location. So there is no visual display of this change.

A message about the change, could be added to console output, if you wish. But a repeated GUI message, would just annoy users.

comment:11 by digitall, 6 years ago

Component: Port: Win32
Note: See TracTickets for help on using tickets.