Guest User

Untitled

a guest
Mar 19th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.83 KB | None | 0 0
  1. using System.IO;
  2. using UnityEngine;
  3. using UnityEditor;
  4. using UnityEditor.Callbacks;
  5. using System.Diagnostics;
  6.  
  7. public static class PostBuildHelper
  8. {
  9. private static DirectoryInfo targetdir;
  10. private static string buildname;
  11. private static string buildDataDir;
  12. private static DirectoryInfo projectParent;
  13.  
  14. // Name of folder in project directory containing files for build
  15. private static int filecount;
  16. private static int dircount;
  17.  
  18. /// Processbuild Function
  19. [PostProcessBuild] // <- this is where the magic happens
  20. public static void OnPostProcessBuild(BuildTarget target, string path)
  21. {
  22. if (Raider.Game.BuildConfig.VOIP_ENABLED) //If the build doesn't use VoIP then there's no point in deploying the dependencies.
  23. {
  24. UnityEngine.Debug.Log("Post Processing Build");
  25.  
  26. // Get Required Paths
  27. buildname = Path.GetFileNameWithoutExtension(path);
  28. targetdir = Directory.GetParent(path);
  29. char divider = Path.DirectorySeparatorChar;
  30. #if UNITY_STANDALONE_WIN
  31. string dataMarker = "_Data"; // Specifically for Windows Standalone build
  32. #elif UNITY_STANDALONE_OSX
  33. string dataMarker = Path.GetExtension(path) + divider + "Contents" ;
  34. #endif
  35. #if UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX
  36. buildDataDir = targetdir.FullName + divider + buildname + dataMarker + divider;
  37. Directory.CreateDirectory(buildDataDir + "Plugins" + divider + "soundbackends");
  38. #if UNITY_STANDALONE_WIN
  39. File.Copy(Application.dataPath + divider + "Third Party Assets/Audio/Teamspeak 3 SDK/x86" + divider + "soundbackends" + divider + "directsound_win32.dll", buildDataDir + "Plugins" + divider + "soundbackends" + divider + "directsound_win32.dll");
  40. File.Copy(Application.dataPath + divider + "Third Party Assets/Audio/Teamspeak 3 SDK/x64" + divider + "soundbackends" + divider + "directsound_win64.dll", buildDataDir + "Plugins" + divider + "soundbackends" + divider + "directsound_win64.dll");
  41. File.Copy(Application.dataPath + divider + "Third Party Assets/Audio/Teamspeak 3 SDK/x86" + divider + "soundbackends" + divider + "windowsaudiosession_win32.dll", buildDataDir + "Plugins" + divider + "soundbackends" + divider + "windowsaudiosession_win32.dll");
  42. File.Copy(Application.dataPath + divider + "Third Party Assets/Audio/Teamspeak 3 SDK/x64" + divider + "soundbackends" + divider + "windowsaudiosession_win64.dll", buildDataDir + "Plugins" + divider + "soundbackends" + divider + "windowsaudiosession_win64.dll");
  43. #elif UNITY_STANDALONE_OSX
  44. File.Copy(Application.dataPath + divider + "Third Party Assets/Audio/Teamspeak 3 SDK/mac" + divider + "soundbackends" + divider + "libcoreaudio_mac.dylib",buildDataDir + "Plugins" + divider + "soundbackends" + divider + "libcoreaudio_mac.dylib");
  45. #endif
  46. #endif
  47. }
  48. }
  49. }
Add Comment
Please, Sign In to add comment