Skip to content
Snippets Groups Projects
Commit 27f217ef authored by Richard Marcus's avatar Richard Marcus
Browse files

.bat can now handle spaces, server cannot

parent c20a2a45
No related branches found
No related tags found
No related merge requests found
...@@ -25,18 +25,68 @@ void PrepareGame() ...@@ -25,18 +25,68 @@ void PrepareGame()
} }
IEnumerator ServerRoutine() IEnumerator ServerRoutine1()
{ {
string command = "\"" + Application.streamingAssetsPath + "\"/start.BAT "+ "\"" + Application.streamingAssetsPath + "\"" ;
command = command.Replace("/", @"\");
command = "\"" + command + "\"";
UnityEngine.Debug.Log(command);
ProcessStartInfo processInfo;
Process process;
//processInfo = new ProcessStartInfo("cmd.exe", "/C " + command);
bool cmd = true;
if (cmd)
{
processInfo = new ProcessStartInfo("cmd.exe", "/C " + command);
// processInfo.CreateNoWindow = false;
// processInfo.UseShellExecute = true;
process = Process.Start(processInfo);
}else
/*
*/
Process.Start("powershell.exe", command);
// *** Read the streams ***
// Warning: This approach can lead to deadlocks, see Edit #2
//string output = process.StandardOutput.ReadToEnd();
//string error = process.StandardError.ReadToEnd();
// exitCode = process.ExitCode;
// UnityEngine.Debug.Log(output);
// UnityEngine.Debug.Log(error);
// Console.WriteLine("output>>" + (String.IsNullOrEmpty(output) ? "(none)" : output));
// Console.WriteLine("error>>" + (String.IsNullOrEmpty(error) ? "(none)" : error));
// Console.WriteLine("ExitCode: " + exitCode.ToString(), "ExecuteCommand");
// process.Close();
yield return null;
}
IEnumerator ServerRoutine()
{
UnityWebRequest request = UnityWebRequest.Get("localhost:8081/scroll/list"); UnityWebRequest request = UnityWebRequest.Get("localhost:8081/scroll/list");
yield return request.Send(); yield return request.SendWebRequest();
if (request.isNetworkError || request.isHttpError) if (request.isNetworkError || request.isHttpError)
{ {
UnityEngine.Debug.Log("no running server"); UnityEngine.Debug.Log("no running server");
string command = Application.streamingAssetsPath + "/start.BAT " + Application.streamingAssetsPath; string command = "\"" + Application.streamingAssetsPath + "\"/start.BAT " + "\"" + Application.streamingAssetsPath + "\"";
command = command.Replace("/", @"\");
command = "\"" + command + "\"";
UnityEngine.Debug.Log(command); UnityEngine.Debug.Log(command);
int exitCode; // int exitCode;
ProcessStartInfo processInfo; ProcessStartInfo processInfo;
Process process; Process process;
...@@ -53,10 +103,10 @@ IEnumerator ServerRoutine() ...@@ -53,10 +103,10 @@ IEnumerator ServerRoutine()
while (true) while (true)
{ {
request = UnityWebRequest.Get("localhost:8081/scroll/list"); request = UnityWebRequest.Get("localhost:8081/scroll/list");
yield return request.Send(); yield return request.SendWebRequest();
if (request.isNetworkError || request.isHttpError) if (request.isNetworkError || request.isHttpError)
{ {
UnityEngine.Debug.Log("no running server"); // UnityEngine.Debug.Log("no running server");
} }
else else
{ {
......
...@@ -4,5 +4,11 @@ ...@@ -4,5 +4,11 @@
EditorBuildSettings: EditorBuildSettings:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
serializedVersion: 2 serializedVersion: 2
m_Scenes: [] m_Scenes:
- enabled: 1
path: Assets/StartScreen.unity
guid: 80736d45fa76e1b488eab0eb8650ff3d
- enabled: 1
path: Assets/TreeWorld_02.unity
guid: 9b8063e1ae3c04045b13e20d1ccc73d0
m_configObjects: {} m_configObjects: {}
...@@ -36,6 +36,8 @@ GraphicsSettings: ...@@ -36,6 +36,8 @@ GraphicsSettings:
- {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} - {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 10783, guid: 0000000000000000f000000000000000, type: 0} - {fileID: 10783, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0}
m_PreloadedShaders: [] m_PreloadedShaders: []
m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000,
type: 0} type: 0}
...@@ -60,3 +62,4 @@ GraphicsSettings: ...@@ -60,3 +62,4 @@ GraphicsSettings:
m_AlbedoSwatchInfos: [] m_AlbedoSwatchInfos: []
m_LightsUseLinearIntensity: 0 m_LightsUseLinearIntensity: 0
m_LightsUseColorTemperature: 0 m_LightsUseColorTemperature: 0
m_LogWhenShaderIsCompiled: 0
...@@ -12,8 +12,8 @@ PlayerSettings: ...@@ -12,8 +12,8 @@ PlayerSettings:
targetDevice: 2 targetDevice: 2
useOnDemandResources: 0 useOnDemandResources: 0
accelerometerFrequency: 60 accelerometerFrequency: 60
companyName: DefaultCompany companyName: KWARC
productName: New Unity Project productName: FrameWorld1
defaultCursor: {fileID: 0} defaultCursor: {fileID: 0}
cursorHotspot: {x: 0, y: 0} cursorHotspot: {x: 0, y: 0}
m_SplashScreenBackgroundColor: {r: 0.13725491, g: 0.12156863, b: 0.1254902, a: 1} m_SplashScreenBackgroundColor: {r: 0.13725491, g: 0.12156863, b: 0.1254902, a: 1}
...@@ -155,7 +155,8 @@ PlayerSettings: ...@@ -155,7 +155,8 @@ PlayerSettings:
resolutionScalingMode: 0 resolutionScalingMode: 0
androidSupportedAspectRatio: 1 androidSupportedAspectRatio: 1
androidMaxAspectRatio: 2.1 androidMaxAspectRatio: 2.1
applicationIdentifier: {} applicationIdentifier:
Standalone: com.KWARC.FrameIT
buildNumber: {} buildNumber: {}
AndroidBundleVersionCode: 1 AndroidBundleVersionCode: 1
AndroidMinSdkVersion: 16 AndroidMinSdkVersion: 16
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment