- Home /
OnPostProcessBuild IOException
Hi there,
I have taken a script from another project I'm working on that does some post build processing. Right now I've stripped it right back to just renaming the game's data folder (game_data/) to just "data/".
This works fine in the project I've taken it from, however in this project I continue to get this error:
IOException: Failed to Move File / Directory from 'D:\Game Development\test-game\Build\Test Game_Data\' to 'D:\Game Development\test-game\Build\data\'.
The only code I'm using is by supplying those two directories to:
FileUtil.MoveFileOrDirectory(from, to);
Any help is much appreciated!
Answer by gumboots · Aug 21, 2015 at 12:10 AM
I actually solved this by using:
Directory.Move(from, to);
Instead. No errors, works perfectly every time.
Seems strange?
Answer by HarshadK · Aug 20, 2015 at 06:27 AM
One cause for this is that the source path provided does not exist. Before calling the FileUtil.MoveFileOrDirectory
check if the source path exists.
Other possible reasons are invalid file/directory permissions, file/directory in use by another process.
Thanks for this! However I have actually placed a
Debug.Log(Directory.Exists(from));
Prior to the attempt to move and it always returns true.
Your answer
