StorageFolder.Path Propriedade

Definição

Obtém o caminho completo da pasta atual no sistema de arquivos, se o caminho estiver disponível.

public:
 property Platform::String ^ Path { Platform::String ^ get(); };
winrt::hstring Path();
public string Path { get; }
var string = storageFolder.path;
Public ReadOnly Property Path As String

Valor da propriedade

String

Platform::String

winrt::hstring

O caminho completo da pasta atual no sistema de arquivos, se o caminho estiver disponível.

Implementações

Exemplos

O exemplo a seguir obtém a pasta de instalação do aplicativo e exibe o valor do Caminho da pasta.

using Windows.Storage;
using System.Diagnostics; // For writing results to the Output window.

// Get the app's installation folder.
StorageFolder appFolder = Windows.ApplicationModel.Package.Current.InstalledLocation;

// Print the folder's path to the Visual Studio Output window.
Debug.WriteLine(appFolder.Name + " folder path: " + appFolder.Path);
// Get the app's installation folder.
Windows::Storage::StorageFolder appFolder{ Windows::ApplicationModel::Package::Current().InstalledLocation() };

// Print the path to the debug window.
::OutputDebugString(appFolder.Path().c_str());
// Get the app's installation folder
StorageFolder^ appFolder = Windows::ApplicationModel::Package::Current->InstalledLocation;

//Print the path to the debug window
String^ path = appFolder->Path;
OutputDebugString(path->Begin());

Comentários

Não confie nessa propriedade para acessar uma pasta, pois um caminho do sistema de arquivos não está disponível para algumas pastas. Por exemplo, nos casos a seguir, a pasta pode não ter um caminho do sistema de arquivos ou o caminho do sistema de arquivos pode não estar disponível.

  • A pasta representa um contêiner para um grupo de arquivos (por exemplo, o valor retornado de algumas sobrecargas do método GetFoldersAsync ) em vez de uma pasta real no sistema de arquivos.
  • A pasta é apoiada por um URI.
  • A pasta foi escolhida usando um seletor de arquivos.

Aplica-se a