Tech Off Thread

6 posts

WinRT Temporary folder

Back to Forum: Tech Off
  • LotharV

    Hi

    This is just a small question I couldn't really find an answer on.
    In Windows Store apps, you can access the Temporary folder of your app and you can store files there. But when is this folder cleared? Or does this never happen?

     

    Thanks in advance,

    Lothar

  • wkempf

    As a developer, I don't know why you'd care? Temporary files should be programmatically cleaned up ASAP, at worst during program termination. There are exception to that, like auto-save file type concepts, but even those exceptions leave me wondering why you'd care?

    As a user, you'd care, but the answer is the same as with any temporary file: "Files stored in the folder can be removed at any time by system or by user via Disk Cleanup."

  • figuerres

    , LotharV wrote

    Hi

    This is just a small question I couldn't really find an answer on.
    In Windows Store apps, you can access the Temporary folder of your app and you can store files there. But when is this folder cleared? Or does this never happen?

     

    Thanks in advance,

    Lothar

    I have not read any of the Microsoft Guidelines for Win 8 Store apps but if the temp folder is to be a private "Temp" folder that works like the old standard system level "Temp" folder then I would have my app on startup delete anything in that folder unless it was there to save state of the last run of the app. if my app had such a file I would process that file and then delete it also.

    Temp means *NOT PERMANENT* so keep it clean.

    apps that write temp files and leave them are not nice and over time use up disk space until someone or some process cleans them up.  on most pc's I find crazy numbers of old temp files sometimes taking up gigabytes of disk space.

  • LotharV

    Thanks for the responses. I asked this question because I was wondering if I had to take care of keeping it clean myself.

  • MasterPi

    , LotharV wrote

    Thanks for the responses. I asked this question because I was wondering if I had to take care of keeping it clean myself.

    Probably not, because they wouldn't have had a separate temporary folder otherwise. It's probably a good practice to clean it up in your logic, especially if you shove a ton of data in there, though.

  • evildictait​or

    What language are you writing in? In C#, you can use System.IO.Path.GetTempFileName() / System.IO.Path.GetTempPath()

Comments closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.