From 7ff02567efde4432ace1bc3d2aee1886896ac34f Mon Sep 17 00:00:00 2001 From: Jonathan Harris Date: Fri, 8 Jan 2016 17:39:33 +0000 Subject: [PATCH] Detect log folder under additional Steam libraries On Windows. --- README.md | 2 +- monitor.py | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ab818850..6399c10b 100644 --- a/README.md +++ b/README.md @@ -110,7 +110,7 @@ When looking for the log files, this app assumes: In more detail, this app looks for the folder `elite-dangerous-64` in the following places: 1. In the `Products` folder under the launcher (in English versions of Windows usually `C:\Program Files (x86)\Frontier\EDLaunch\Products`). -2. In the `Elite Dangerous Horizons\Products` folder under Steam (in English versions of Windows usually `C:\Program Files (x86)\Steam\steamapps\common\Elite Dangerous Horizons\Products`). +2. In the `Elite Dangerous Horizons\Products` folder under Steam (in English versions of Windows usually `C:\Program Files (x86)\Steam\steamapps\common\Elite Dangerous Horizons\Products`) and under each Steam library. 3. In the `Elite Dangerous\Products` folder under Steam (in English versions of Windows usually `C:\Program Files (x86)\Steam\steamapps\common\Elite Dangerous\Products`). 4. `%PROGRAMFILES(X86)%\Frontier\Products` (in English versions of Windows usually `C:\Program Files (x86)\Frontier\Products`). 5. `%LOCALAPPDATA%\Frontier_Developments\Products` (usually `C:\Users\you\AppData\Local\Frontier_Developments\Products`). diff --git a/monitor.py b/monitor.py index c20df681..db9ddb66 100644 --- a/monitor.py +++ b/monitor.py @@ -294,8 +294,19 @@ class EDLogs(FileSystemEventHandler): if not RegQueryValueEx(key, 'SteamPath', 0, ctypes.byref(valtype), None, ctypes.byref(valsize)) and valtype.value == REG_SZ: buf = ctypes.create_unicode_buffer(size.value / 2) if not RegQueryValueEx(key, 'SteamPath', 0, ctypes.byref(valtype), buf, ctypes.byref(valsize)): - candidates.append(join(buf.value, 'steamapps', 'common', 'Elite Dangerous Horizons', 'Products')) - candidates.append(join(buf.value, 'steamapps', 'common', 'Elite Dangerous', 'Products')) + steamlibs = [buf.value] + try: + # Simple-minded Valve VDF parser + with open(join(buf.value, 'config', 'config.vdf'), 'rU') as h: + for line in h: + vals = line.split() + if vals and vals[0].startswith('"BaseInstallFolder_'): + steamlibs.append(vals[1].strip('"')) + except: + pass + for lib in steamlibs: + candidates.append(join(lib, 'steamapps', 'common', 'Elite Dangerous Horizons', 'Products')) + candidates.append(join(lib, 'steamapps', 'common', 'Elite Dangerous', 'Products')) RegCloseKey(key) programs = ctypes.create_unicode_buffer(MAX_PATH)