예제 #1
0
파일: Snapx.cs 프로젝트: peters/snapx
        static Snapx()
        {
            lock (SyncRoot)
            {
                if (SnapOs != null)
                {
                    return;
                }

                try
                {
                    Logger = LogProvider.GetLogger(nameof(Snapx));
                    var informationalVersion = typeof(Snapx).Assembly.GetCustomAttribute <AssemblyInformationalVersionAttribute>().InformationalVersion;
                    Version = !NuGetVersion.TryParse(informationalVersion, out var currentVersion) ? null : currentVersion;

                    SnapOs           = AnyOS.SnapOs.AnyOs;
                    WorkingDirectory = SnapOs.Filesystem.PathGetDirectoryName(typeof(Snapx).Assembly.Location);

                    _current = WorkingDirectory.GetSnapAppFromDirectory(SnapOs.Filesystem, new SnapAppReader());

                    typeof(Snapx).Assembly
                    .GetCoreRunExecutableFullPath(SnapOs.Filesystem, new SnapAppReader(), out var supervisorExecutableAbsolutePath);

                    SuperVisorProcessExeDirectory = supervisorExecutableAbsolutePath;
                }
                catch (Exception e)
                {
                    Logger.ErrorException("Unknown error during initialization", e);
                }
            }
        }