StorageFolder.Path Properti

Definisi

Mendapatkan jalur lengkap folder saat ini dalam sistem file, jika jalur tersedia.

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

Nilai Properti

String

Platform::String

winrt::hstring

Jalur lengkap folder saat ini dalam sistem file, jika jalur tersedia.

Penerapan

Contoh

Contoh berikut mendapatkan folder penginstalan aplikasi dan menampilkan nilai Jalur folder.

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

Keterangan

Jangan mengandalkan properti ini untuk mengakses folder, karena jalur sistem file tidak tersedia untuk beberapa folder. Misalnya, dalam kasus berikut, folder mungkin tidak memiliki jalur sistem file, atau jalur sistem file mungkin tidak tersedia.

  • Folder mewakili kontainer untuk sekelompok file (misalnya, nilai pengembalian dari beberapa kelebihan beban metode GetFoldersAsync ) alih-alih folder aktual dalam sistem file.
  • Folder didukung oleh URI.
  • Folder dipilih dengan menggunakan pemilih file.

Berlaku untuk