title: Getting iOS app-private folder Library from the absolute path of Document folder
body: <p>I need to get the complete path of the &quot;Library&quot; private app folder for iOS app.</p>
  <p>In Swift I would access that position with</p>
  <pre><code> let dir = try! FileManager.default.url(for: .libraryDirectory, in: .userDomainMask, appropriateFor: nil, create: true);
  </code></pre>
  <p>and then</p>
  <pre><code> let fileUrl = dir.appendingPathComponent(fileName).appendingPathExtension(&quot;json&quot;);
  </code></pre>
  <p>I read on StackOverflow that the kind of path is like</p>
  <pre><code>file:///var/mobile/Containers/Data/Application/strangenumberslike...EF22-EB33-4B65-9772-67ED7870E3E9/Library/
  </code></pre>
  <p>where the question did refer to &quot;Document&quot; (so the example could be wrong).</p>
  <p>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.</p>
  <p>I think that it is just matter of substrings (JAVA), being said that the folder has the same &quot;root&quot;.</p>
  <p>Maybe</p>
  <pre><code>String root=documentPath.substring(0,documentPath.indexOf(&quot;Document&quot;));
  String libraryPath=root+&quot;/Library&quot;;
  </code></pre>
  <p>Is this possible?</p>