Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
207 views
in Technique[技术] by (71.8m points)

java - Getting iOS app-private folder Library from the absolute path of Document folder

I need to get the complete path of the "Library" private app folder for iOS app.

In Swift I would access that position with

 let dir = try! FileManager.default.url(for: .libraryDirectory, in: .userDomainMask, appropriateFor: nil, create: true);

and then

 let fileUrl = dir.appendingPathComponent(fileName).appendingPathExtension("json");

I read on StackOverflow that the kind of path is like

file:///var/mobile/Containers/Data/Application/strangenumberslike...EF22-EB33-4B65-9772-67ED7870E3E9/Library/

where the question did refer to "Document" (so the example could be wrong).

My need is getting the Library folder in that form in a cross-platform environment that cannot retrieve it directly, but it has the Document absolute path.

I think that it is just matter of substrings (JAVA), being said that the folder has the same "root".

Maybe

String root=documentPath.substring(0,documentPath.indexOf("Document"));
String libraryPath=root+"/Library";

Is this possible?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share

2.1m questions

2.1m answers

63 comments

56.7k users

...