Program
How do I use Program
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
Line | Code | Ex.. |
---|---|---|
72 | static string ProgramFilesx86() | 1 |
413 | ProgramFilesx86() + Path.DirectorySeparatorChar + "Microsoft VS Code" | 2 |
File name: VSCode.cs
Copy
72 static string ProgramFilesx86()
73 {
74 if( 8 == IntPtr.Size
75 || (!String.IsNullOrEmpty(Environment.GetEnvironmentVariable("PROCESSOR_ARCHITEW6432"))))
76 {
77 return Environment.GetEnvironmentVariable("ProgramFiles(x86)");
78 }
79
80 return Environment.GetEnvironmentVariable("ProgramFiles");
81 }
File name: VSCode.cs
Copy
403 static string AutodetectCodePath()
404 {
405 string[] possiblePaths =
406#if UNITY_EDITOR_OSX
407 {
408 "/Applications/Visual Studio Code.app",
409 "/Applications/Visual Studio Code - Insiders.app"
410 };
411#elif UNITY_EDITOR_WIN
412 {
413 ProgramFilesx86() + Path.DirectorySeparatorChar + "Microsoft VS Code"
414 + Path.DirectorySeparatorChar + "bin" + Path.DirectorySeparatorChar + "code.cmd",
415 ProgramFilesx86() + Path.DirectorySeparatorChar + "Microsoft VS Code Insiders"
416 + Path.DirectorySeparatorChar + "bin" + Path.DirectorySeparatorChar + "code-insiders.cmd"
417 };
418#else
419 {
420 "/usr/bin/code",
421 "/bin/code",
422 "/usr/local/bin/code"
423 };
424#endif
425 for(int i = 0; i < possiblePaths.Length; i++)
426 {
427 if(VSCodeExists(possiblePaths[i]))
428 {
429 return possiblePaths[i];
430 }
431 }
432 PrintNotFound(possiblePaths[0]);
433 return possiblePaths[0]; //returns the default one, printing a warning message 'executable not found'
434 }
Download file with original file name:Program
Program 115 lượt xem
Gõ tìm kiếm nhanh...