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:
    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

    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:
    228
    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:
    228
    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:
    84
    Yeah the docs are just totally wrong for Linux. (Classic!)
     
  13. umaradil

    umaradil

    Joined:
    Dec 11, 2018
    Posts:
    4
    i am having an error (UnauthorizedAccessException: Access to the path 'C:\Users\UmaradilAzar\AppData\LocalLow\Runner\RunnerUI' is denied)
    is anyone have an idea how to get permission for linux ?
     
  14. ChiwTheNeko

    ChiwTheNeko

    Joined:
    Mar 24, 2022
    Posts:
    136
    That path does not exist on Linux. It's not a permission problem, you are just getting an invalid path.
     
    umaradil likes this.
  15. umaradil

    umaradil

    Joined:
    Dec 11, 2018
    Posts:
    4
    At the moment am working on windows, it is not giving me permission for persistent datapath, later on i would switch the build for linux