private static void WriteBeeBatchFile(NPath directory)
        {
            var file = directory.Combine("bee");

            // Then write out some helper bee/bee.cmd scripts
            using (StreamWriter sw = new StreamWriter(file.ToString()))
            {
                sw.NewLine = "\n";
                sw.WriteLine($@"#!/bin/sh");
                sw.WriteLine();
                sw.WriteLine("MONO=");
                sw.WriteLine($@"BEE=""$PWD/{BeePath.RelativeTo(directory).ToString(SlashMode.Forward)}""");
                sw.WriteLine("BEE=$(printf %q \"$BEE\")");
                sw.WriteLine($@"if [ ""$APPDATA"" == """" ] ; then");
                sw.WriteLine("    MONO=mono");
                sw.WriteLine("fi");
                sw.WriteLine("cmdToRun=\"${MONO} ${BEE} $*\"");
                sw.WriteLine("if [ $# -eq 0 ]; then");
                sw.WriteLine("    eval \"${cmdToRun} -t\"");
                sw.WriteLine("  else");
                sw.WriteLine("    eval \"${cmdToRun}\"");
                sw.WriteLine("fi");
            }

            var cmdFile = directory.Combine("bee.cmd");

            using (StreamWriter sw = new StreamWriter(cmdFile.ToString()))
            {
                sw.NewLine = "\n";
                sw.WriteLine("@ECHO OFF");
                sw.WriteLine($@"set bee=%~dp0{BeePath.RelativeTo(directory).ToString(SlashMode.Backward)}");
                sw.WriteLine($@"if [%1] == [] (%bee% -t) else (%bee% %*)");
            }
        }
Esempio n. 2
0
        private static void WriteBeeBatchFile(NPath directory)
        {
            var file = directory.Combine("bee");

            // Then write out some helper bee/bee.cmd scripts
            using (StreamWriter sw = new StreamWriter(file.ToString()))
            {
                sw.NewLine = "\n";
                #if UNITY_EDITOR_LINUX
                sw.WriteLine($@"#!/bin/bash");
                #else
                // sh is not good enough for printf, but on mac it'll be either zsh or bash
                sw.WriteLine($@"#!/bin/sh");
                #endif
                sw.WriteLine();
                sw.WriteLine("MONO=");
                sw.WriteLine($@"BEE=""$PWD/{BeePath.RelativeTo(directory).ToString(SlashMode.Forward)}""");
                sw.WriteLine("BEE=$(printf %q \"$BEE\")");
                sw.WriteLine($@"if [ ""$APPDATA"" == """" ] ; then");
                sw.WriteLine("    MONO=mono");
                sw.WriteLine("fi");
                sw.WriteLine("cmdToRun=\"${MONO} ${BEE} $*\"");
                sw.WriteLine("if [ $# -eq 0 ]; then");
                sw.WriteLine("    eval \"${cmdToRun} -t\"");
                sw.WriteLine("  else");
                sw.WriteLine("    eval \"${cmdToRun}\"");
                sw.WriteLine("fi");
            }

#if !UNITY_EDITOR_WIN
            System.Diagnostics.Process.Start("chmod", $"+x \"{file.ToString()}\"")
            .WaitForExit();
#endif

            var cmdFile = directory.Combine("bee.cmd");
            using (StreamWriter sw = new StreamWriter(cmdFile.ToString()))
            {
                sw.NewLine = "\n";
                sw.WriteLine("@ECHO OFF");
                sw.WriteLine($@"set bee=%~dp0{BeePath.RelativeTo(directory).ToString(SlashMode.Backward)}");
                sw.WriteLine($@"if [%1] == [] (%bee% -t) else (%bee% %*)");
            }
        }