Search Unity

Path of Application.persistentDataPath on Linux?

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

  1. _Adriaan

    _Adriaan

    Joined:
    Nov 12, 2009
    Posts:
    466
    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:
    980
    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:
    466
    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:
    466
    FWIW: Steam's documentation states that LinuxXdgDataHome points to $XDG_DATA_HOME/ or $HOME/.local/share/.
     
  5. Necronomicron

    Necronomicron

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

    _Adriaan

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

    Arthur-LVGameDev

    Joined:
    Mar 14, 2016
    Posts:
    166
    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:
    466


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

    Arthur-LVGameDev

    Joined:
    Mar 14, 2016
    Posts:
    166
    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:
    1
    home/.config/unity3d/DefaultCompany/[project]
     
unityunity