[gnome-games/wip/exalm/steam] steam: Skip Steam instance if .steam directory is a symlink



commit 7596122c541e0538d5c08be2c10ea71dc7cbb3a0
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date:   Sat Oct 20 19:14:08 2018 +0500

    steam: Skip Steam instance if .steam directory is a symlink
    
    Steam itself never makes this directory symlink, so assume it's pointing
    to another installation and skip it to avoid duplicate games.
    
    Fixes #128

 plugins/steam/src/steam-uri-source.vala | 7 +++++++
 1 file changed, 7 insertions(+)
---
diff --git a/plugins/steam/src/steam-uri-source.vala b/plugins/steam/src/steam-uri-source.vala
index 8d67c92d..b5e8bc23 100644
--- a/plugins/steam/src/steam-uri-source.vala
+++ b/plugins/steam/src/steam-uri-source.vala
@@ -1,6 +1,8 @@
 // This file is part of GNOME Games. License: GPL-3.0+.
 
 private class Games.SteamUriSource : Object, UriSource {
+       // From the home directory.
+       private const string STEAM_DIR = "/.steam";
        // From the home directory.
        private const string REGISTRY_PATH = "/.steam/registry.vdf";
        // From the home directory.
@@ -25,6 +27,11 @@ private class Games.SteamUriSource : Object, UriSource {
                var registry = new SteamRegistry (registry_path);
                var install_path = registry.get_data (INSTALL_PATH_REGISTRY_PATH);
 
+               // If `.steam` dir is a symlink, it could be pointing to another Steam
+               // installation, so skip it altogether to avoid duplicating games
+               if (FileUtils.test (base_dir + STEAM_DIR, FileTest.IS_SYMLINK))
+                       return;
+
                add_library (base_dir + DEFAULT_INSTALL_DIR_SYMLINK);
 
                if (install_path == null)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]