locked
[UWP] Installing App Data RRS feed

  • Question

  • Hi Everyone

    I have some files for a conversation AI app which will be user editable. How do you go about putting files into the local storage folder (or somewhere with read/write access) when the app is installed. 

    The conversation AI app allows them to use and edit the conversation xml files (in different languages[en-US], [zh-CH]) and is also an extension to another application. The other application does not need direct access to the conversation xml files.

    Hope thats clear

    thanks

    Friday, April 21, 2017 5:13 AM

Answers

  • Hello hypodyne1,

    The installed location is a readonly place for security reason. That's why localfolder is always used if you need to update your data. For example, if you have SQLite database then we always put it under local folder.

    For settings and versions we have this way:

    "You can store your app data in app-specific, versioned formats. For more info, see Version and SetVersionAsync."

    Here are blogs about versioning and you can have a look:

    https://blogs.windows.com/buildingapps/2014/06/19/common-questions-and-answers-about-files-and-app-data-part-1-app-data/#7Uk6LkBbEd1rcZqr.97

    For your scenario I recommend you put all your logic to your local folder. You can use your code to create your file in local folder instead of using installed location. In this way you can also reduce your package's size.

    Best regards,

    Barry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by hypodyne1 Tuesday, April 25, 2017 10:19 AM
    Tuesday, April 25, 2017 2:16 AM

All replies

  • Hello hypodyne1,

    There are some local storage in UWP to store your data, this is wrote in here:

    https://docs.microsoft.com/en-us/uwp/api/windows.storage.applicationdata

    So can you clarify what you is your problem first? If you mean your files are stored in installed location. You have to copy them out to local folder, then you can write and read it at runtime.

    Best regards,

    Barry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    • Edited by Barry Wang Monday, April 24, 2017 7:15 AM
    Monday, April 24, 2017 7:15 AM
  • Hi Barry

    Thanks for the reply.

    The problem is that is an ugly solution to the problem. Every time the application runs it has to check if the files have been installed, if not install them. And I have to check in two places, because there is two entry points to the application. What happens when I update the application with new language files, now I have to check not only that they exist, but they are the latest version.

    It would be a lot better if when installing the app that the files got moved to the local storage. finished.

    The ugly solution seems to be the only solution, and I am half way through writing a File Manger. I am glad I don't have any application settings as well.

    thanks

    Monday, April 24, 2017 12:57 PM
  • Hello hypodyne1,

    The installed location is a readonly place for security reason. That's why localfolder is always used if you need to update your data. For example, if you have SQLite database then we always put it under local folder.

    For settings and versions we have this way:

    "You can store your app data in app-specific, versioned formats. For more info, see Version and SetVersionAsync."

    Here are blogs about versioning and you can have a look:

    https://blogs.windows.com/buildingapps/2014/06/19/common-questions-and-answers-about-files-and-app-data-part-1-app-data/#7Uk6LkBbEd1rcZqr.97

    For your scenario I recommend you put all your logic to your local folder. You can use your code to create your file in local folder instead of using installed location. In this way you can also reduce your package's size.

    Best regards,

    Barry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by hypodyne1 Tuesday, April 25, 2017 10:19 AM
    Tuesday, April 25, 2017 2:16 AM