- Home /
Access file with unknown path?
Basically, file is somewhere in c/users/someKnownPath/unknownsubFolder/file.xml
and the file.xml
contains the name of unknownsubFolder
So how do i load file.xml without knowing the unknownSubFolder?
Im kinda trying to explain it so there are no further questions, so ima add screenshot.
How do i load the library.xml file, if i dont know that its in BridgeParts folder? I know its in OfficialLibraries, but idk where excatly, (Loading all Library.xml files from all subfolders of OfficialLibraries and storing them in list works as well)
i dont need to be explained on how to load the file, but just how to get to it. Library.XML has a line which says BridgeParts, if i can open the file without knowing the full path, then i can complete it anyways.
Attempt 3 at making this short and understandable XD I dont know this file is in BridgeParts sub folder, but i know its in OfficialLibraries. Library.XML contains a line which says BridgeParts. How do i get a full path to Library.XML?
Answer by frostspike · May 04, 2020 at 10:31 AM
From the way i understand your question, you're looking to find a specific file without knowing where it is contained - and this file is -not- in your unity assets? If the item.xml is within your unity assets typically you could use Resource.Load - here is a reference https://docs.unity3d.com/ScriptReference/Resources.html?_ga=2.124272908.702685365.1588336665-614137247.1571912079
However, if it is not within your unity assets, honestly i think the best way for you would be to simply find a directory known to you - and loop through its children checking for the file in question i.e a loop that checks in "officialLibraries" and loops through every folder checking its contents for "items.xml" or what item you might be looking for. This is generally just using nested for loops. If you dont know what these are, perhaps go check a general c# IO tutorial, friend.
Your answer
Follow this Question
Related Questions
Saving or Reading text file works on Mac but not on iOS 1 Answer
Stream Writer cant find part of path 0 Answers
Problem with path in FileStream 2 Answers
put Camera on path with touch &/or arrow keys 1 Answer
Resources.Load problem 1 Answer