Forum Discussion

Re: 🛠️ Creating a symlink in macOS to store the Sims 4 folder on an external drive

@cjso794o1aaw 

Did some testing. I started with an empty Mods folder and moved it to a new folder called SimsStorage in the Electronic Arts folder (the game would actively ignore this folder):

I then created a symlink to this Mods folder from the Sims 4 Mods folder and added one piece of CC. It successfully loaded in the game.

I then created another folder called TestCC and placed it directly in the Documents folder:

I then created a symlink to this folder in the Mods folder and moved the piece of CC into this TestCC folder. Loaded the game and the CC did not load.

I moved the piece of CC back into the Mods folder and it loaded:

I trashed the TestCC folder symlink and instead created a symlink for the individual piece of CC. It loaded successfully into the game:

ln -s ~/Documents/TestCC/BBFTestSymlink.package ~/Documents/Electronic\ Arts/The\ Sims\ 4/Mods/BBFTestSymlink.package

And of course if I trash that symlink and move the TestCC folder into the Mods folder, the CC also loads fine:

Now I'm asking the same question as you! Why doesn't the CC load in a nested folder as it should when a symlink has been created? 

2 Replies

  • cjso794o1aaw's avatar
    cjso794o1aaw
    2 years ago

    Thank you for your thorough testing!! That's exactly it!

    I experimented a bit with scripts in my Terminal; I doubt the game is actually written in Python but I know mods use it, so I tried to test what os.walk() saw in my Mods folder. 

    Turns out os.walk() has an option called followlinks, which is set to False by default. So by default, Python will see files/folders that are symlinks, but will not go through a symlink directory without being told so with followlinks=True. That would explain all of your tests! Especially if a symlink to a file works, but not a symlink to a directory.

    Here's the code I tested and the results it yielded if it's of any interest :

    Spoiler

    Here are my test files in context :

    Here is my code :

    import os
    rootdir = '/Users/user/Documents/Electronic Arts/Global Mods/Modern'
    
    # Chunk of code to ignore folders we do not care about
    dont_go_there = ['1Quarantine', 'BuildBuy', 'BuildBuyMods', 'CAS', 'CASMods', 'GameplayMods']
    def has_keyword(path):
        results = []
        for keyword in dont_go_there:
            results.append(keyword in path)
        return (True in results)
    
    # Going through folders and subfolders
    for full_path, subdirs, children in os.walk(rootdir, followlinks=False):
        if not has_keyword(full_path):
            print(full_path)
            print('\t Has the following subdirs =>', subdirs)
            print('\t Has the following files =>', children)

    And running this with followlinks=False will yield the following result :

    $ python3 test.py
    /Users/user/Documents/Electronic Arts/Global Mods/Modern
    	 Has the following subdirs => ['CAS', 'CASMods', 'TestSymlinkDirectory', 'BuildBuy', 'GameplayMods', '1Quarantine', 'BuildBuyMods']
    	 Has the following files => ['.DS_Store', 'TestSylinkFile.sh', 'Resource.cfg']

    So it can see TestSymlinkDirectory as a child of Modern, but it doesn't go through. TestSylinkFile.sh is here no problem.

    If followlinks is set to true however, it will list the directory and its children :

    $ python3 test.py
    /Users/user/Documents/Electronic Arts/Global Mods/Modern
    	 Has the following subdirs => ['CAS', 'CASMods', 'TestSymlinkDirectory', 'BuildBuy', 'GameplayMods', '1Quarantine', 'BuildBuyMods']
    	 Has the following files => ['.DS_Store', 'TestSylinkFile.sh', 'Resource.cfg']
    /Users/user/Documents/Electronic Arts/Global Mods/Modern/TestSymlinkDirectory
    	 Has the following subdirs => ['CAS', 'CASMods', 'BuildBuy', 'BuildBuyMods']
    	 Has the following files => ['.DS_Store']

    I guess there could be an equivalent "issue" in the game code? 

    What blows my mind is that the Windows build isn't tripped up by the use of symlinks inside the Mods folder, and I would have thought the same bit of in-game code was used for both platforms. So either the way files are loaded is different between the builds (and a tiny parameter is missing); or the way the same bit of code is executed changes between Windows and Mac OS systems. That's actually pretty cool to know!

    I'm sorry, it's my first time using Answers HQ; could you tell me how I could "report" this to the developers?

    I don't have much hope of seeing it fixed -- if the "Me too" button could go sub-zero, that'd be for me and my weird use-case -- and it's not like it's a real problem, but I think it'd be a shame to lose such a nifty feature between the two platforms 😅

    Thank you again for all your help!

  • Bluebellflora's avatar
    Bluebellflora
    Hero+
    2 years ago
    @cjso794o1aaw

    That is so interesting, thanks so much for taking the time to post the explanation. I have no experience of Python but it is something I want to learn, it's near the top of the to do list 🙂

    I'm forwarding this to EA QV. I don't hold out much hope they will do anything, it isn't exactly game breaking but I like to think someone will take an interest 🙂