title: iOS file path is changing at every launch/rerun the application
body: <p>I have an issues in changing the file path at every launch of the app.
  I have a file(&quot;AppConstant.json&quot;) in application bundle, and this file I need to copy into application document directory. I am successfully saving &quot;AppConstant.json&quot; file inside the created user folder &quot;MyFolder&quot; on Document directory.</p>
  <p>But the problem is when I relaunch the application second time, it's not showing the same path. Also I am using relativepath, but still it not getting.</p>
  <p>here is the code
  // calling the directory</p>
  <pre><code>let stringAppConstant = copyFileFromBundleToDocumentDirectory(resourceFile: &quot;AppConstant&quot;, resourceExtension: &quot;json&quot;)
  </code></pre>
  <p>// saving or get exit file path</p>
  <pre><code>func copyFileFromBundleToDocumentDirectory(resourceFile: String, resourceExtension: String) -&gt; String 
    {
          var stringURLPath = &quot;Error_URLPath&quot;
          let fileManager = FileManager.default
          let docURL = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).first!
          let destFolderPath = URL(string:docURL)?.appendingPathComponent(&quot;MyFolder&quot;)
          let fileName = &quot;\(resourceFile).\(resourceExtension)&quot;
          guard let newDestPath = destFolderPath, let sourcePath = Bundle.main.path(forResource: resourceFile, ofType: &quot;.\(resourceExtension)&quot;), let fullDestPath = NSURL(fileURLWithPath: newDestPath.absoluteString).appendingPathComponent(fileName) else {
              return stringURLPath
          }
  
         if !fileManager.fileExists(atPath: newDestPath.path) {
              do {
                  try fileManager.createDirectory(atPath: newDestPath.path,withIntermediateDirectories: true, attributes: nil)
                  print(&quot;Created folder successfully in :::&quot;, newDestPath.path)
              } catch {
                  print(&quot;Error in creating folder :::&quot;,error.localizedDescription);
              }
          }
          else {
              print(&quot;Folder is already exist!&quot;)
          }
          if fileManager.fileExists(atPath: fullDestPath.path) {
              print(&quot;File is exist in ::: \(fullDestPath.path)&quot;)
              stringURLPath = fullDestPath.path
          }
          else {
              do {
                  try fileManager.copyItem(atPath:  sourcePath, toPath: fullDestPath.path)
                  print(&quot;Saved file successfully in :::&quot;, fullDestPath.path)
                  stringURLPath = fullDestPath.path
              } catch {
                  print(&quot;Error in creating file ::: \(error.localizedDescription)&quot;)
              }
          }
          return stringURLPath
      }
  </code></pre>
  <p>Please help me, where I need to save the path in Sandbox. Is this right way what I implemented.</p>
  <p>I am running in device and simulator, both path are different while relaunch
  this is the path for first time launch:
  /var/mobile/Containers/Data/Application/81B568A7-0932-4C3E-91EB-9DD62416DFE8/Documents/MyFolder/AppConstant.json</p>
  <p>relaunch the application I am getting new path:
  /var/mobile/Containers/Data/Application/3DAABAC3-0DF5-415B-82A5-72B204311904/Documents/MyFolder/AppConstant.json</p>
  <p><strong>NOTE: I create a sample project and I use this same code and it's working. But in existing project it's not working. I am using the same bundle id and profile only for both sample and project. Checked the file added reference, settings, version all are same.</strong></p>
  <p>Any idea?</p>