Hello,
i want path outside the application.
The Maccatalyst app complies with Application Sandbox rules from Apple. In terms of the file system, your application is limited to creating and deleting files and directories in its home directory. Therefore, you cannot access folders outside of your app.
Please refer to the following code to visit the Document /Library folder:
var path = Path.Combine( Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), localFileName);// document folder
var localpath = Path.Combine(FileSystem.AppDataDirectory, localFileName);//library folder
File.WriteAllText(path, CurrentContents);
For more details, please see File system helpers - .NET MAUI | Microsoft Learn
FileSystem.AppDataDirectory
Returns the Library directory that is backed up by iTunes and iCloud.
And File system access in Xamarin.iOS - Xamarin | Microsoft Learn (This doc is about Xamain.iOS, it applies to MAUI Maccatalyst)
Best Regards,
Wenyan Zhang
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.