Example #1
0
        ///////////////////////////////////////////////////////////////////////

        private static string GetAssemblyPath()
        {
            return(GlobalState.GetAssemblyPath());
        }
Example #2
0
        ///////////////////////////////////////////////////////////////////////

        private static string GetNativeLibraryFileName(
            Interpreter interpreter /* NOT USED */
            )
        {
            string path = CommonOps.Environment.GetVariable(
                EnvVars.UtilityPath);

            if (!String.IsNullOrEmpty(path))
            {
                if (File.Exists(path))
                {
                    return(path);
                }

                if (Directory.Exists(path))
                {
                    string fileName = PathOps.CombinePath(
                        null, path, DllName.Utility);

                    if (File.Exists(fileName))
                    {
                        return(fileName);
                    }

                    //
                    // TODO: Is this strictly necessary here?  It is known
                    //       at this point that this file does not exist.
                    //       Setting the path here only controls the result
                    //       returned in non-strict mode (below).
                    //
                    path = fileName;
                }

                //
                // NOTE: If the environment variable was set and the utility
                //       library could not be found, force an invalid result
                //       to be returned.  This ends up skipping the standard
                //       automatic utility library detection logic.
                //
                lock (syncRoot)
                {
                    return(strictPath ? null : path);
                }
            }

            //
            // HACK: If the processor architecture ends up being "AMD64", we
            //       want it to be "x64" instead, to match the platform name
            //       used by the native utility library project itself.
            //
            string processorName = PlatformOps.GetAlternateProcessorName(
                RuntimeOps.GetProcessorArchitecture(), true, false);

            if (processorName != null)
            {
                path = PathOps.CombinePath(
                    null, GlobalState.GetAssemblyPath(), processorName,
                    DllName.Utility);

                if (File.Exists(path))
                {
                    return(path);
                }
            }

            path = PathOps.CombinePath(
                null, GlobalState.GetAssemblyPath(), DllName.Utility);

            if (File.Exists(path))
            {
                return(path);
            }

            lock (syncRoot)
            {
                return(strictPath ? null : path);
            }
        }