Syncing application settings using symbolic links

Syncing application settings using symbolic links

Modern software now starts including features to sync settings (such as tool preferences) to a server, often the one from the software's vendor. This is pretty neat as it allows for better continuity when working across devices. But the majority of software still doesn't include this functionality. This is probably due to the fact that this is a continuous service that requires upkeep, maintenance and investment.
In this article, I will detail a method of implementing this synchronization of settings that worked quite well for me. To use this method for yourself you will need some cloud storage with local synchronization capabilities such as Microsoft OneDrive, Google Drive or Nextcloud. It is also advisable that the synchronization agent is running at system startup. You also need an operating system that supports symbolic links. In the case of Windows, you need an installation that runs on build 14972 or newer.
The following is a step-by-step manual on how to implement this method, explained by doing so for the software EPOS Gaming Suite, which is the configuration interface for my headset on Windows.

Step 1: Finding the setting files of the target software

There are 3 locations in which most software saves its settings and configuration files (on Windows):

  • AppData (which can be navigated to by hitting Win+R, entering %APPDATA% and then hitting Enter)
  • ProgramData (which can be found under the path C:\ProgramData)
  • Documents (which would contain a folder named after the application or the application's vendor)

Some applications (especially old ones) save their settings in the Registry, in which case the implementation of this method would require a serialization of those registry entries, a hook to trigger it and then the reverse for remote changes.

For the EPOS Gaming Suite, the setting files are located in C:\ProgramData\EPOS\Gaming Suite. I chose to only sync the files in the subfolder CUSTOMPRESET because there were other directories with files that indicated being driver-specific. This choice also demonstrates the common sense and technical inclination you need to apply to successfully implement this method. Try to identify and exclude files that are machine-specific (such as driver configuration files) otherwise you may render the software unusable. Also try to identify the need to include a whole directory or just a couple of files. Here are a few things to look out for:

  • A directory of files that indicate that more files may be created during runtime (such as file0.xml, file1.xml, file2.xml etc.).
  • Files that may contain info specific to that machine (such as `recentprojects.xml` or `driverconfig.ini`).
  • License files that could cause the software installation on a different machine to try and use the same license, causing a licensing conflict.

Step 2: Backup up the original files

Create a backup of the original files you located in step 1, just in case.

Step 3: Setting up your cloud file structure

This is of course up to you, but I chose to create a folder named AppData directly in the OneDrive folder. Then I activated the option Always keep on this device in the context menu for the entire folder. That is optional but good practice as it forces OneDrive to always keep the files up-to-date and to not delete the local copies during automatic cleanup.

Step 4: Copying the original setting files to the cloud and deleting the originals

Firstly, make sure that the software you're doing this for isn't running (don't forget to check for running services or tray icons as well).Then copy the setting files you located earlier into a subfolder of the AppData folder. I like to create a folder with the software's name and then either place the files into that folder or create another subfolder named after the original subfolder and place the files there.

So in case of the EPOS Gaming suite the original path of the files is C:\ProgramData\EPOS\Gaming Suite\CUSTOMPRESET and the path in my OneDrive is C:\Users\crono\OneDrive\AppData\EPOS Gaming Suite\CUSTOMPRESET.

Now you can delete the original folder (or file(s)) to prepare for the symbolic link. For the EPOS Gaming Suite I only deleted the CUSTOMPRESET folder and left the other files alone.

Now it is time to make the software think that nothing changed. This is achieved using symbolic links.

Depending on your choices from step 1 (whether to target the entire directory, a sub-directory or individual files), you will need to create one or several symbolic links to recreate the exact file structure.

For the EPOS Gaming Suite I invoked the following PowerShell command in the C:\ProgramData\EPOS\Gaming Suite directory:

New-Item -ItemType SymbolicLink -Name "CUSTOMPRESET" -Value "C:\Users\crono\OneDrive\AppData\EPOS Gaming Suite\CUSTOMPRESET"

The New-Item cmdlet automatically detects whether the specified -Value is a directory or a file.
In case you want to stick to CLI tools, you can use the mklink utility but you need to specify that it is a directory using the /D switch:

mklink /D "CUSTOMPRESET" "C:\Users\crono\OneDrive\AppData\EPOS Gaming Suite\CUSTOMPRESET"

Step 6: Testing it out

After creating the symbolic links, double check the directory structure. Then, start the software and check if your settings are still as before. Next, make a change to your settings and save. If OneDrive starts syncing one of the files in the AppData directory, the upload works! To fully test the implementation, do the same process on another machine and check if the settings of the applications remain in sync.

Limitations and final words

It is important to remember that this method is (most likely) not something the developer of the software thought about in their implementation. It is a bodge and may break at any time. You may need to update the symbolic links or the directory structure in the future and you may experience crashes and data loss if something goes wrong. Here is a list of things to look out for:

  • Updates of the software. This can not only pose a problem because the software may change the format of its setting files or the directory structure of its user-specific data but it may also delete and recreate the folder structure during an update (which will also wipe out your symbolic links).
  • Concurrency conflicts. If you have implemented this on multiple machines on which you then run the software at the same time you may run into the problem that the one instance overwrites the data from the other. Remember that the content on screen is not necessarily the data on disk.
  • Working offline or with a slow connection. Living in rural Germany, a slow internet connection is sadly still widespread (yes, even in 2021). Therefore, the sync agent may not have finished syncing recent changes when you launch the software. So you could run into a situation where you launch your software while the agent is still syncing the settings files and then the old version gets read by the software. Unaware of this situation you make changes to some unrelated settings and upon saving, the software overwrites the settings file with your local changes, wiping out the remote changes. Remember that Windows also automatically pauses syncing when the battery is low.
  • Software running at system start. If, like my headset configuration interface, the software runs at system start, then the chance that the sync agent hasn't finished syncing the settings files dramatically increases. That wasn't really an issue with my headset software because I don't change the presets that often and if I notice a missing or old one, I'll simply restart the software.

As you can see, this method is quite involved when setting it up and cannot be guaranteed to run steadily. But I implemented this on my computers and I have been quite happy with the results. My headset presets as well as my development settings and swatches in the Affinity suite are available on all my computers, which has been very neat.

Marcel Diskowski

Marcel Diskowski