Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Path of Application.persistentDataPath on Linux?

Discussion in 'Linux' started by _Adriaan, Dec 25, 2016.

  1. _Adriaan

    _Adriaan

    Joined:
    Nov 12, 2009
    Posts:
    481
    Hey there!

    The internet wasn't able to tell me where Unity's Application.persistentDataPath points to on Linux, so I figured asking about that here. I'd love to make my save games on Linux compatible with Steam's Auto-Cloud for which I have the following options:

    LinuxHome/[Company]/[ProjectName]
    LinuxXdgDataHome/[Company]/[ProjectName]

    Any ideas where Application.persistentDataPath points to on Linux?
     
  2. Tak

    Tak

    Unity Technologies

    Joined:
    Mar 8, 2010
    Posts:
    1,001
    persistentDataPath is $XDG_CONFIG_HOME/unity3d/Company/ProjectName (XDG_CONFIG_HOME defaults to ~/.config)

    You can get XDG_DATA_HOME (or its default of ~/.local/share) by calling Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)
     
  3. _Adriaan

    _Adriaan

    Joined:
    Nov 12, 2009
    Posts:
    481
    So I should probably fill in the following in Steam Auto-Cloud, right?

    [LinuxXdgDataHome]/unity3d/[Company]/[ProjectName]
     
  4. _Adriaan

    _Adriaan

    Joined:
    Nov 12, 2009
    Posts:
    481
    FWIW: Steam's documentation states that LinuxXdgDataHome points to $XDG_DATA_HOME/ or $HOME/.local/share/.
     
  5. Necronomicron

    Necronomicron

    Joined:
    Mar 4, 2015
    Posts:
    108
    I guess, [LinuxXdgConfigHome].
     
  6. _Adriaan

    _Adriaan

    Joined:
    Nov 12, 2009
    Posts:
    481
    After a bunch of testing, apparently [LinuxHome] was the right one, leading to: .config/unity3d/CompanyName/GameName
     
    MaxLohMusic and iwsundstrom like this.
  7. Arthur-LVGameDev

    Arthur-LVGameDev

    Joined:
    Mar 14, 2016
    Posts:
    226
    This is nearly cheating, but mind if I ask what you ended up with for the entirety of your auto-cloud config? =D

    Or really, the Linux one specifically is the one I'm hoping to avoid doing a full 1/2 day+ of rebooting into various distros in order to test.

    Thanks in advance either way -- I know how 'fun' this trial & error stuff is, figured worth a shot to ask. :)
     
  8. _Adriaan

    _Adriaan

    Joined:
    Nov 12, 2009
    Posts:
    481


    My save files end with '.data', hence the pattern.
     
  9. Arthur-LVGameDev

    Arthur-LVGameDev

    Joined:
    Mar 14, 2016
    Posts:
    226
    Ah, that's awesome -- thank you, can't thank you enough! =D

    If there's ever anything we can do for you shoot us a message! :)
     
  10. Elizeuvix

    Elizeuvix

    Joined:
    Jan 29, 2020
    Posts:
    2
    home/.config/unity3d/DefaultCompany/[project]
     
  11. Bastienre4

    Bastienre4

    Joined:
    Jul 8, 2014
    Posts:
    191
    wilgieseler likes this.
  12. wilgieseler

    wilgieseler

    Joined:
    Oct 17, 2013
    Posts:
    62
    Yeah the docs are just totally wrong for Linux. (Classic!)