0
\$\begingroup\$

I am trying to copy some files into the build directory after completing a build, but the path provided as an argument to OnPostProcessBuild does not exist.

[PostProcessBuildAttribute(1)]
 public static void OnPostprocessBuild(BuildTarget target, string pathToBuildProject)
    {
        if (target.ToString() == "iOS")
        {
            Debug.Log("Build Finished for target : " + target.ToString());
            Debug.Log("Build Finished at Path : " + pathToBuildProject);
            Debug.Log("File pick location : " + objectiveCCodeFilePath);

            //Pasted in the xcode exported build
            xCodeBuildPath = pathToBuildProject + "/Classes";
            Debug.Log("File paste location : " + xCodeBuildPath);
            Debug.Log("System.IO.File.Exists(objectiveCCodeFilePath) : " + System.IO.File.Exists(objectiveCCodeFilePath));
            Debug.Log("Build path without classes : " + System.IO.File.Exists(pathToBuildProject));//return false
            Debug.Log("Build path with classes : " + System.IO.File.Exists(xCodeBuildPath));//return false, but the same path is opening in explorer
            //MonoBehaviour.Invoke("CopyFile",2);
            //StartCoroutine

        }


    }

This is showing false. What I am doing wrong?

 Debug.Log("Build path without classes : " + System.IO.File.Exists(pathToBuildProject));//return false
            Debug.Log("Build path with classes : " + System.IO.File.Exists(xCodeBuildPath));//return false, 

but the same path is opening in explorer

\$\endgroup\$
6
  • 1
    \$\begingroup\$ Have you tried printing the contents of pathToBuildProject and comparing that string to the folder structure you observe in your file explorer? How do the two compare? \$\endgroup\$
    – DMGregory
    Sep 8 at 11:19
  • \$\begingroup\$ Sorry, but how can I do this? The folder structure creates after the build. \$\endgroup\$ Sep 8 at 12:08
  • \$\begingroup\$ I think the evern is running a bit earlier then creating the build folder. I tried to used Invoke and coroutine but they are not usable without monobehaviour. \$\endgroup\$ Sep 8 at 12:12
  • \$\begingroup\$ Step 1: add code to print the path to the debug console, as shown in the documentation. Step 2: build the game and write down what gets printed to the console. Step 3: now that the build has been run, look at the folder it created in your file explorer. \$\endgroup\$
    – DMGregory
    Sep 8 at 12:12
  • \$\begingroup\$ yeah it is exactly the same and opening the file! \$\endgroup\$ Sep 8 at 12:20

0

You must log in to answer this question.

Browse other questions tagged .