Search Issue Tracker

Fixed in 4.5.5

Votes

0

Found in

4.3.4f1

Issue ID

589686

Regression

No

Application.persistentDataPath is not correct for OSX

Deployment Management

-

To reproduce:
1. Create a new project
2. Create a new script
3. Add Debug.Log(Application.persistentDataPath); to the Start() function
4. Attach the script to the main camera

See that the path is /Users/<UserName>/Library/Caches/<CompanyName>/<ApplicationName>/ when it should be /Users/<UserName>/Library/Application Support/<ApplicationName>/

Reasoning:
/Users/<UserName>/Library/Caches is not an appropriate to store persistent data and users either themselves or with existing disk cleanup tools routinely clear the contents of the ~/Library/Caches/ directory and blow away user generated files or save game files etc. The ~/Library/Caches is intended for files that only need temporary persistence, hence the name "Caches". Besides, Unity already provides another path for temporary data in the existing Application.temporaryCachePath variable that developers should probably use for truly temporary cache data.

Comments (7)

  1. shubhamswaraj2021

    Aug 20, 2020 01:53

    good one <a href="https://www.lyricsauto.com">lyricsauto</a>

  2. davekalina

    Feb 17, 2015 19:43

    It appears that if you have existing save data in /Caches, it will continue to use that folder as your "persistentDataPath" even though it isn't remotely persistent, and it won't migrate your data to a better/safer location, even though that would be the right thing to do.

    I suppose one could log that as a separate bug.

  3. HoMeBoYErik

    Nov 17, 2014 11:03

    I think this bug is showing again in Unity 4.5.5p5.
    In Debug.Log the persistentDatapath is written as :

    /Users/<username>/Library/Caches/<Company Name>/<Product Name>/

    but

    at runtime it writes to

    /Users/<UserName>/Library/Application Support/<CompanyName>/<ApplicationName>/

    So I have a couple of Plugins (like Acid NoSQL Data Storage that fails to initialize the files)

  4. PAHeartBeat

    Oct 28, 2014 13:13

    its has been solved in Unity 4.5.5P1, you can find it bellow given location, if you give name of company then you have to check 2nd path.

    /Users/<UserName>/Library/Application Support/<ApplicationName>/
    /Users/<UserName>/Library/Application Support/<CompanyName>/<ApplicationName>/

  5. Deozaan

    Sep 12, 2014 18:21

    This is still an issue as of Unity 4.6 beta 18.

  6. xpkoalz

    May 31, 2014 14:09

    sorry, have hidden my "library" folder..

  7. xpkoalz

    May 31, 2014 13:54

    I still can't find my saved file on my mac, thing is there is no Library folder inside ~ /Users/<UserName>...and I tried searching everywhere else with the folder name Library, there's no file name <ApplicationName>/*test.dat* ...what is going on?

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.