When scripting you have access to the system, not only SYMPHOLIGHT. So you will have to consider the different characteristics of the operating systems, where Sympholight is running.
Especially between Core S and LCE there are some differences like
- different time
- different file system
- different paths
So you will need to know, on which system you are working. And you need to implement some parts twice, if the same script should work as well on an LCE as on a Core S. The following small script will help you to check, which OS you are using.
using System;
using Scripting;
/// <summary>
/// Detect the current platform (OS)
/// </summary>
/// <remarks>
/// Author: Christoph Paduch
/// Year: 2017
/// </remarks>
public static class Platform
{
/// <summary>
/// The method called from the workflow.
/// </summary>
/// <param name="Windows">true if current platform is Windows (On PC)</param>
/// <param name="Unix">true if current platform is Unix (Core S)</param>
/// <param name="Xbox">true if current platform is Xbox (theoretical value)</param>
/// <param name="Mac">true if current platform is Mac (probably possible)</param>
/// <returns></returns>
public static String Run( out bool Windows, out bool Unix, out bool Xbox, out bool Mac)
{
Windows = false;
Unix = false;
Xbox = false;
Mac = false;
var os = Environment.OSVersion;
switch (os.Platform)
{
case PlatformID.MacOSX:
Mac = true;
break;
case PlatformID.Unix:
Unix= true;
break;
case PlatformID.Xbox:
Xbox = true;
break;
default:
Windows = true;
break;
}
return "" + os.Platform;
}
/// <summary>
/// Returns if the current platform is windows.
/// </summary>
/// <returns>true, if it is Windows, otherwise false.</returns>
public static bool IsWindows()
{
bool retVal, temp;
Run(out retVal, out temp, out temp, out temp);
return retVal;
}
/// <summary>
/// Returns if the current platform is linux (and this means Core S).
/// </summary>
/// <returns>true, if it is Linux, otherwise false.</returns>
public static bool IsCoreS()
{
bool retVal, temp;
Run(out temp, out retVal, out temp, out temp);
return retVal;
}
}