Sunday, May 19, 2024
HomeiOS Developmentc# - Sources folder path location in iOS .NET MAUI

c# – Sources folder path location in iOS .NET MAUI


I’m constructing an archery app to maintain rating. I’ve a folder referred to as ScoreData
reData during which I’m writing to a file and storing in. When scoring is completed, I need to write the information to a easy .txt file in stated folder. For my home windows debugging, it’s looking out the answer utilizing GetEntryAssembly and going up a folder every time till it finds the ScoreData folder. This resolution offers me no errors when debugging utilizing “Home windows Machine” however once I hook up my iPhone to debug, it throws errors on the GetDirectories() technique.

Right here is the present code I’ve that does work with Home windows, however throws errors when debugging on an iOS machine.

`var anotherDir = Path.GetDirectoryName(Meeting.GetEntryAssembly().Location);
var meeting = typeof(App).GetTypeInfo().Meeting;
//var location = meeting.Location;  
//var dirst = Meeting.GetEntryAssembly();  
//var dires = Listing.GetDirectories(dirst.ToString());  
var listing = new DirectoryInfo(anotherDir ?? Listing.GetCurrentDirectory());
var path = string.Empty;
whereas (listing != null && !listing.GetFiles("*.sln").Any())
{
     listing = listing.Mother or father;
     var folders = listing.GetDirectories();
     if (folders.Size == 9)
     {
          var folder = folders[6];
          path = folder.FullName;
     }
}
return path;
`

And here’s a screenshot of the place I’m eager to get the filepath for when debugging in iOS.
enter picture description right here



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments