Search Issue Tracker

Fixed in Unity 4.5.5

Votes

0

Found in

4.3.4f1

Issue ID

589686

Regression

No

Application.persistentDataPath is not correct for OSX

Deployment Management

-

-

Priority: 3Not yet prioritized for a release

-

Severity: 4Minor or cosmetic issue

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 (6)

  1. 7657a1fa2b6ba5bf617a34a3670fcb80?d=mm

    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.

  2. 47c5765ec82f514bf202c17d3814a13f?d=mm

    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)

  3. E7aa527f6f8787c3a19dea695cc5a050?d=mm

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

  4. 558a5ae60831435db5cd443a909eec2f?d=mm

    Deozaan

    Sep 12, 2014 18:21

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

  5. F9a7bbfa118ba128afe6b35822a772bc?d=mm

    xpkoalz

    May 31, 2014 14:09

    sorry, have hidden my "library" folder..

  6. F9a7bbfa118ba128afe6b35822a772bc?d=mm

    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?

All about bugs

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