locked
How to find the Install and App Data directories

    Question

  • Please note from following locations you can open files using 'fopen()'.

     1.Install folder of application.

     2.Appdata folder of application.

    A couple of question on this:

     - If I am debugging in VS, what is the Install folder / Appdata folder? Are these predefined paths, or how do you determine what these are?

     - Similarly for a standalone application, how do I programmatically determine what these are. Are there any samples with this in mind?

    Thanks,

    Nick.

    Thursday, October 04, 2012 7:09 PM

Answers

  • InstalledLocation is the AppX Directory(under the debug/release folder) of you project where *.exe is created and Windows Store Apps runs.

    You can get the location in c++ by followings........

    Appdata folder of application
    Windows::Storage::ApplicationDataContainer^ localSettings = Windows::Storage::ApplicationData::Current->LocalSettings;
    Windows::Storage::StorageFile^ localStorageFolder = Windows::Storage::ApplicationData::Current->LocalFolder;

    Install folder of application
    Windows::ApplicationModel::Package^ package = Windows::ApplicationModel::Package::Current;
    Windows::Storage::StorageFolder^ installedLocation = package->InstalledLocation;

    Documents Directory
    Windows::Storage::StorageFolder^ installedLocation = KnownFolders::DocumentsLibrary;

    Getting Patth
    Platform::String^ outputPath = "Installed Location: " + installedLocation->Path;

    • Marked as answer by Jesse Jiang Wednesday, October 10, 2012 6:39 AM
    Friday, October 05, 2012 4:27 PM
  • You can get the installed location with Package->InstalledLocation and the app data folders from the ApplicationData class .See Accessing app data with the Windows Runtime

    When debugging in VS the app doesn't usually get deployed so the InstalledLocation will be within your project, but I usually dump the app data paths to OutputDebugString to make them easy to find.

    --Rob

    • Marked as answer by Jesse Jiang Wednesday, October 10, 2012 6:40 AM
    Thursday, October 04, 2012 7:25 PM
    Owner

All replies

  • You can get the installed location with Package->InstalledLocation and the app data folders from the ApplicationData class .See Accessing app data with the Windows Runtime

    When debugging in VS the app doesn't usually get deployed so the InstalledLocation will be within your project, but I usually dump the app data paths to OutputDebugString to make them easy to find.

    --Rob

    • Marked as answer by Jesse Jiang Wednesday, October 10, 2012 6:40 AM
    Thursday, October 04, 2012 7:25 PM
    Owner
  • InstalledLocation is the AppX Directory(under the debug/release folder) of you project where *.exe is created and Windows Store Apps runs.

    You can get the location in c++ by followings........

    Appdata folder of application
    Windows::Storage::ApplicationDataContainer^ localSettings = Windows::Storage::ApplicationData::Current->LocalSettings;
    Windows::Storage::StorageFile^ localStorageFolder = Windows::Storage::ApplicationData::Current->LocalFolder;

    Install folder of application
    Windows::ApplicationModel::Package^ package = Windows::ApplicationModel::Package::Current;
    Windows::Storage::StorageFolder^ installedLocation = package->InstalledLocation;

    Documents Directory
    Windows::Storage::StorageFolder^ installedLocation = KnownFolders::DocumentsLibrary;

    Getting Patth
    Platform::String^ outputPath = "Installed Location: " + installedLocation->Path;

    • Marked as answer by Jesse Jiang Wednesday, October 10, 2012 6:39 AM
    Friday, October 05, 2012 4:27 PM