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	est-game\Build\Test Game_Data\' to 'D:\Game Development	est-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!

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.

I actually solved this by using:

Directory.Move(from, to);

Instead. No errors, works perfectly every time.

Seems strange?