本文整理汇总了C#中String.Expand方法的典型用法代码示例。如果您正苦于以下问题:C# String.Expand方法的具体用法?C# String.Expand怎么用?C# String.Expand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类String
的用法示例。
在下文中一共展示了String.Expand方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: buildCompilerInvocation
public virtual String buildCompilerInvocation(String command, bool alt)
{
command = command.Expand();
var magicPrefix = "scalac ";
if (!command.StartsWith(magicPrefix)) { println("scalac: compiler command must start from \"" + magicPrefix + "\""); return null; }
command = command.Substring(magicPrefix.Length);
var javaParts = command.Split(' ').Where(part => part.StartsWith("-D")).ToList();
var javaNoDefaults = javaParts.Contains("-Dnodefault") || javaParts.Contains("-Dnodefaults");
javaParts = javaParts.Where(part => part != "-Dnodefault" && part != "-Dnodefaults").ToList();
if (!javaNoDefaults) javaParts = Enumerable.Concat(defaultJavaopts.Split(' '), javaParts).ToList();
javaParts.ToList().ForEach(part => {
if (part.StartsWith("-Dno")) {
var negation = "-D" + part.Substring(4);
javaParts.Remove(part);
javaParts.Remove(negation);
}
});
var javaOpts = String.Join(" ", javaParts.ToArray());
if (Config.sublime) javaOpts += " -Djline.terminal=scala.tools.jline.UnsupportedTerminal";
var scalaParts = command.Split(' ').Where(part => !part.StartsWith("-D")).ToList();
var scalaNoDefaults = scalaParts.Contains("-nodefault") || scalaParts.Contains("-nodefaults");
scalaParts = scalaParts.Where(part => part != "-nodefault" && part != "-nodefaults").ToList();
if (!scalaNoDefaults) scalaParts = Enumerable.Concat(defaultScalaopts.Split(' '), scalaParts).ToList();
scalaParts.ToList().ForEach(part => {
if (part.StartsWith("-no")) {
var negation = "-" + part.Substring(3);
scalaParts.Remove(part);
scalaParts.Remove(negation);
}
});
var scalaOpts = String.Join(" ", scalaParts.ToArray());
var f_classpathConfig = new FileInfo("%SCRIPTS_HOME%/scalac.classpath".Expand());
var useBootClasspath = f_classpathConfig.Exists && File.ReadAllText(f_classpathConfig.FullName) == "boot";
var nobootTemplate = @"%JAVA_HOME%\bin\java.exe -cp ""$CLASSPATH$"" $JAVAOPTS$ scala.tools.nsc.Main $SCALAOPTS$";
var bootTemplate = @"%JAVA_HOME%\bin\java.exe -Xbootclasspath/a:""$CLASSPATH$"" $JAVAOPTS$ scala.tools.nsc.Main $SCALAOPTS$";
command = useBootClasspath ? bootTemplate : nobootTemplate;
command = command.Replace("$CLASSPATH$", inferScalaClasspath(alt));
command = command.Replace("$JAVAOPTS$", javaOpts);
command = command.Replace("$SCALAOPTS$", scalaOpts);
// println(command);
return command.Expand();
}