Skip to content

Commit

Permalink
Updated support for Steam libraries
Browse files Browse the repository at this point in the history
Paths to Steam libraries do not have to be entered manually anymore as
they are read from "libraryfolders.vdf" in "\Steam\SteamApps\".
  • Loading branch information
Kapiainen committed Jun 6, 2015
1 parent 845cf47 commit b17badc
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 20 deletions.
3 changes: 0 additions & 3 deletions Lauhdutin/@Resources/UserSettings.inc
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ SteamPath=
;UserDataID corresponding to your Steam account.
UserDataID=

;Paths to Steam libraries that are not located in the same place as your Steam installation. Multiple paths can be separated with a semicolon (;).
SteamLibraryPaths=

;Width of a game's banner in pixels. Default value is 274.
BannerWidth=274
Expand Down
26 changes: 17 additions & 9 deletions Lauhdutin/Lauhdutin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ function Initialize()
end
S_PATH_STEAM = Trim(S_PATH_STEAM)
end
S_PATH_STEAM_LIBRARIES = SKIN:GetVariable('SteamLibraryPaths', nil)
S_STEAM_USER_DATA_ID = SKIN:GetVariable('UserDataID', nil)
if S_STEAM_USER_DATA_ID ~= nil then
S_STEAM_USER_DATA_ID = Trim(S_STEAM_USER_DATA_ID)
Expand All @@ -61,6 +60,7 @@ function Initialize()
S_VDF_KEY_APP_TICKETS = 'apptickets'
S_VDF_KEY_APP_STATE = 'AppState'
S_VDF_KEY_USER_CONFIG = 'UserConfig'
S_VDF_KEY_LIBRARY_FOLDERS = 'LibraryFolders'

-- Miscellaneous
T_GAMES = {} -- List of all games.
Expand Down Expand Up @@ -239,21 +239,28 @@ end
tNonSteamGames = nil
end

-- Steam games and non-Steam games that have been added to the Steam library.
local tSteamLibraryPaths = {}
table.insert(tSteamLibraryPaths, S_PATH_STEAM)
if S_PATH_STEAM_LIBRARIES ~= nil then
for sLibraryPath in S_PATH_STEAM_LIBRARIES:gmatch('([^;]+)') do
if sLibraryPath ~= nil then
if sLibraryPath ~= '' and EndsWith(sPath, '\\') == false then
sLibraryPath = sLibraryPath .. '\\'
local tSteamLibraryFolders = ParseVDFFile(S_PATH_STEAM .. 'SteamApps\\libraryfolders.vdf')
if tSteamLibraryFolders ~= nil then
tSteamLibraryFolders = tSteamLibraryFolders[S_VDF_KEY_LIBRARY_FOLDERS]
if tSteamLibraryFolders ~= nil then
for sKey, sValue in pairs(tSteamLibraryFolders) do
if tonumber(sKey) then
if sValue ~= '' then
if not EndsWith(sValue, '\\') then
sValue = sValue .. '\\'
end
table.insert(tSteamLibraryPaths, sValue)
end
end
sLibraryPath = Trim(sLibraryPath)
end
table.insert(tSteamLibraryPaths, sLibraryPath)
else
print('Error: The "LibraryFolders" key-value pair could not be found in "\\Steam\\SteamApps\\libraryfolders.vdf"')
end
end

-- Steam games and non-Steam games that have been added to the Steam library.
if S_PATH_STEAM ~= nil and S_PATH_STEAM ~= '' then
if S_STEAM_USER_DATA_ID == nil or S_STEAM_USER_DATA_ID == '' then
DisplayMessage('Missing Steam UserDataID#CRLF#or invalid Steam path')
Expand Down Expand Up @@ -395,6 +402,7 @@ end
end
end
end

if #tGames > 0 then
AcquireBanner()
end
Expand Down
2 changes: 1 addition & 1 deletion Lauhdutin/Main.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Name=Lauhdutin
Author=Kapiainen
Information=A launcher for Steam and non-Steam games, movies, misc. software, etc.
Version=1.2.1
Version=1.3.0
License=MIT

[Rainmeter]
Expand Down
7 changes: 0 additions & 7 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,6 @@ The UserDataID corresponding to your Steam account. This can be found by looking
UserDataID=123456789
```

##SteamLibraryPaths
One or more absolute paths to folders containing Steam libraries. Multiple paths should be separated by a semicolon (;).

```
SteamLibraryPaths=D:\Steam Library;E:\Steam Library
```

##BannerWidth
The width of a banner in pixels.

Expand Down

0 comments on commit b17badc

Please sign in to comment.