Opened 12 years ago

Closed 12 years ago

Last modified 8 years ago

#1438 closed defect (fixed)

[PATCH] Sort out Windows log path pre-Vista

Reported by: historic_bruno Owned by: ben
Priority: Should Have Milestone: Alpha 11
Component: Non-game systems Keywords: patch
Cc: Patch:

Description (last modified by historic_bruno)

With Alpha 10, the Windows data paths for the game have changed, see #1145. Logs are placed in "local application data" but Windows Vista changed the layout of application data to be more explicitly divided between roaming and local. There's a new environment variable since Vista, %localappdata%, typically used to refer to the new path for convenience. But it doesn't exist on XP and there's no equivalent, so a path constructed with %localappdata% will fail. Here's a comparison to show what we're dealing with:

  • XP/2000: C:\Documents and Settings\Ben\Local Settings\Application Data\
  • Vista+: C:\Users\Ben\AppData\Local\

It's tempting to simply use e.g. "%userprofile%\Local Settings\Application Data\" as a hack, but apparently the path is localized so that would fail for many of our users (in German it's "\Lokale Einstellungen\Anwendungsdaten\").

So there's two problems. We need a consistent way of telling Windows users how to find and access the game's logs. And we need to automate this so we don't have to mention messy details like %localappdata% in the first place. If feasible, we should put the logic into the existing OpenLogsFolder.bat. If not feasible, we should delete the batch file and make a single Trac page with clear instructions. Likewise README.txt is currently incorrect and outdated.

We need one place we can refer people for finding logs and crash dumps in Windows.

(Of course really idealistically we would have an automated error reporter tool #192/#193 and nobody would care where they were stored, but this is a short term fix)

Attachments (1)

windows-openlogsfolder.patch (4.2 KB ) - added by historic_bruno 12 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 by historic_bruno, 12 years ago

Description: modified (diff)

comment:2 by historic_bruno, 12 years ago

Summary: Sort out logs path on pre-VistaSort out Windows log path pre-Vista

comment:3 by historic_bruno, 12 years ago

Philip found a good simple solution, this VBScript will open the logs folder if it exists:

Set objShell = CreateObject("Shell.Application")
objShell.Explore objShell.Namespace(&H1C&).Self.Path & "\0ad\logs"

Confirmed to work on a clean XP install. This should only be a last resort in case %localappdata% doesn't work as it won't on XP.

I created a Trac page to describe all the data paths by OS, GameDataPaths. We can direct people to that page as needed.

by historic_bruno, 12 years ago

comment:4 by historic_bruno, 12 years ago

Keywords: review patch added
Summary: Sort out Windows log path pre-Vista[PATCH] Sort out Windows log path pre-Vista

Attaching patch which:

  • Moves log folder batch file to source/tools for organization
  • Adds VBScript to open log folder on XP/2000
  • Updates README.txt to link ReportingErrors for maintainability (and it's more helpful to have screenshots, etc.)
  • Updates Windows installer script to copy these new files and adds an "Open logs folder" shortcut to the start menu

The VBScript doesn't technically have to be a separate file, but in my opinion, it's best not to be obfuscated in the batch file (using a labels hack). It's less suspicious and easier to understand if it's a separate file clearly marked as a tool.

Last edited 12 years ago by historic_bruno (previous) (diff)

comment:5 by ben, 12 years ago

Owner: set to ben
Resolution: fixed
Status: newclosed

In 12068:

Fixes log folder script on WinXP/2000. Moves script inside source/tools. Adds start menu shortcut to the installer. Updates README. Fixes #1438

comment:6 by sanderd17, 8 years ago

Keywords: review removed
Note: See TracTickets for help on using tickets.